1import{g as ae,o as I,q as oe}from"./chunk-NC5IGWSY.js";import"./chunk-E7H5LJYL.js";import{a as B,c as U,e as W,f as T,g as J,h as K,m as Q,n as X,p as Y,q as Z,r as ee,s as te,t as ne,x as ie,z as re}from"./chunk-Z3WVMVNS.js";import{i as z,n as q}from"./chunk-YZOQ5XEY.js";import{$ as w,Bb as E,Db as G,Dc as H,Eb as f,G as V,Jb as o,Kb as $,Pa as F,Ua as c,W as L,Zb as A,_a as x,_b as j,eb as D,ga as S,ha as k,kb as b,qb as l,sc as M,tc as R,vb as r,wb as n,xb as C,yb as N,zb as P,zc as O}from"./chunk-BXNCUBZ2.js";var le=(()=>{class t{db;toast;catGen;constructor(e,i,a){this.db=e,this.toast=i,this.catGen=a}generateCategory(e,i,a,p,u){let g=this.catGen.currentVal();g.isLoading=!0,this.catGen.nextVal(g),this.db.generateCategory("season",e,i,a,p,u).pipe(V(1)).subscribe({next:s=>{g.isLoading=!1,g.players=s.players||[],g.hasGenerated=s.generated,this.catGen.nextVal(g),s.generated?this.toast.create("Season category created","success",3e3):g.players.length===0&&this.toast.create("No players match","error",3e3)},error:s=>{console.error(s),g.isLoading=!1,this.catGen.nextVal(g),this.toast.create("Error generating category","error",3e3)}})}revert(){let e=this.catGen.currentVal();e.players=[],e.hasGenerated=!1,this.catGen.nextVal(e)}static \u0275fac=function(i){return new(i||t)(w(U),w(ae),w(I))};static \u0275prov=L({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function me(t,d){if(t&1&&(r(0,"option",21),o(1),n()),t&2){let e=d.$implicit;l("value",e.key),c(),$(e.label)}}function de(t,d){if(t&1&&(r(0,"option",21),o(1),n()),t&2){let e=d.$implicit;l("value",e.key),c(),$(e.label)}}function ge(t,d){if(t&1&&(r(0,"option",21),o(1),n()),t&2){let e=d.$implicit;l("value",e.key),c(),$(e.label)}}function ue(t,d){if(t&1){let e=E();r(0,"button",24),G("click",function(){S(e);let a=f(3);return k(a.search(!1))}),o(1,"Validate"),n()}if(t&2){let e=f(3);l("disabled",e.form.invalid)}}function fe(t,d){if(t&1){let e=E();r(0,"button",32),G("click",function(){S(e);let a=f(4);return k(a.search(!0))}),o(1,"Create"),n()}}function _e(t,d){if(t&1){let e=E();r(0,"div",25)(1,"div",26)(2,"h3"),o(3,"Players found!"),n(),r(4,"p"),o(5,"There are "),r(6,"span",27),o(7),n(),o(8," players matching this category."),n()(),r(9,"div",28)(10,"button",29),G("click",function(){S(e);let a=f(3);return k(a.revert())}),o(11,"Revert"),n(),r(12,"button",30),G("click",function(){S(e);let a=f(3);return k(a.openPlayers())}),o(13,"Show Players"),n(),b(14,fe,2,0,"button",31),n()()}if(t&2){let e=f(2).ngIf;c(7),$(e.players.length),c(7),l("ngIf",!e.hasGenerated)}}function ye(t,d){if(t&1&&(N(0),b(1,ue,2,1,"button",22)(2,_e,15,2,"div",23),P()),t&2){let e=f().ngIf;c(),l("ngIf",!e.hasGenerated&&e.players.length===0),c(),l("ngIf",e.players.length>0)}}function be(t,d){t&1&&C(0,"app-spinner")}function ve(t,d){if(t&1&&(r(0,"div",1)(1,"div",2)(2,"a",3),o(3,"\u2190 Back"),n()(),r(4,"h1",4),o(5,"Season Stats Category Generator"),n(),r(6,"p",5),o(7,"*Use decimal for percentage stats e.g. FG% the threshold could be 0.5 for 50%"),n(),r(8,"form",6)(9,"div",7)(10,"div",8)(11,"label",9),o(12,"Measure"),n(),r(13,"select",10),b(14,me,2,2,"option",11),n()(),r(15,"div",8)(16,"label",9),o(17,"Stat"),n(),r(18,"select",12),b(19,de,2,2,"option",11),n()(),r(20,"div",8)(21,"label",9),o(22,"*Threshold"),n(),C(23,"input",13),n(),r(24,"div",8)(25,"label",9),o(26,"Condition"),n(),r(27,"select",14),b(28,ge,2,2,"option",11),n()()(),r(29,"h3",15),o(30,"Preview"),n(),r(31,"div",16)(32,"div",8)(33,"label",9),o(34,"Text"),n(),C(35,"div",17),n(),r(36,"div",8)(37,"label",9),o(38,"Description"),n(),C(39,"input",18),n(),r(40,"div",8)(41,"label",9),o(42,"Code"),n(),C(43,"input",19),n()(),r(44,"div",15),b(45,ye,3,2,"ng-container",20)(46,be,1,0,"app-spinner",20),n()()()),t&2){let e=d.ngIf,i=f();c(8),l("formGroup",i.form),c(6),l("ngForOf",i.measures),c(5),l("ngForOf",i.filteredStatTypes),c(9),l("ngForOf",i.conditions),c(7),l("innerHTML",i.generatedTextSafe,F),c(10),l("ngIf",!e.isLoading),c(),l("ngIf",e.isLoading)}}var Le=(()=>{class t{fb;dialog;catGen;seasonGen;sanitizer;form;categoryGenerate$;generatedTextSafe;latestRawText="";measures=[{key:"avg",label:"Average per Game"},{key:"total",label:"Season Total"}];statTypes=[{key:"pts",label:"Points"},{key:"reb",label:"Rebounds"},{key:"ast",label:"Assists"},{key:"stl",label:"Steals"},{key:"blk",label:"Blocks"},{key:"pf",label:"Personal Fouls"},{key:"tov",label:"Turnovers"},{key:"min",label:"Minutes"},{key:"fg3Pct",label:"3PT%",longLabelDesc:"Three point percentage"},{key:"ftPct",label:"FT%",longLabelDesc:"Free throw percentage"},{key:"fgPct",label:"FG%",longLabelDesc:"Field goal percentage"},{key:"oreb",label:"Offensive Rebounds"},{key:"dreb",label:"Defensive Rebounds"},{key:"fga",label:"Field Goal Attempts"},{key:"fgm",label:"Field Goals Made"}];conditions=[{key:"lte",label:"At most (\u2264)"},{key:"gte",label:"At least (\u2265)"}];constructor(e,i,a,p,u){this.fb=e,this.dialog=i,this.catGen=a,this.seasonGen=p,this.sanitizer=u,this.categoryGenerate$=this.catGen.categoryGenerate$}ngOnInit(){this.form=this.fb.group({measure:["avg",T.required],statType:["pts",T.required],threshold:[0,[T.required]],condition:["gte",T.required],generatedDescription:[""],generatedCode:[""]}),this.form.valueChanges.subscribe(e=>{let i=e.measure,a=e.statType,p=e.threshold,u=e.condition,g=`season_${i}_${a}_${p}_${u}`,s=this.statTypes.find(m=>m.key===a).label,_=this.statTypes.find(m=>m.key===a).longLabelDesc,h="<br>(Season)",y="",v="";if(i==="avg"&&a.endsWith("Pct")){let m=Math.round(p*100);u==="lte"?(y=`${m}% or less ${s}${h}`,v=`Had a ${_||s.toLowerCase()} of under ${m}% in a single regular season.`):(y=`${m}%+ ${s}${h}`,v=`Achieved a ${_||s.toLowerCase()} of ${m}% or higher in a single regular season.`)}else if(i==="avg")u==="lte"?(y=`Under ${p} ${a==="pts"?"ppg":s}${h}`,v=`Averaged under ${p}${a==="pts"?" points":" "+_?_:s.toLowerCase()} per game in a single regular season.`):(y=`${p}+ ${s} per Game${h}`,v=`Averaged ${u==="lte"?"at most":"at least"} ${p} ${_||s.toLowerCase()} per game in a single regular season.`);else{let m=a==="pts"?"Points":s;u==="lte"?(y=`Under ${p} ${m}${h}`,v=`Recorded fewer than ${p} ${m.toLowerCase()} in a single regular season.`):(y=`${p}+ ${m}${h}`,v=`Recorded ${u==="lte"?"at most":"at least"} ${p} ${m.toLowerCase()} in a single regular season.`)}this.generatedTextSafe=this.sanitizer.bypassSecurityTrustHtml(y),this.latestRawText=y.replace(/<br>/g,` 2`),this.form.patchValue({generatedDescription:v,generatedCode:g},{emitEvent:!1})}),this.seasonGen.revert()}get filteredStatTypes(){return this.form?.get("measure")?.value==="total"?this.statTypes.filter(i=>!i.key.endsWith("Pct")):this.statTypes}
2search(e){if(this.form.invalid)return;let{generatedCode:i,generatedDescription:a}=this.form.value;this.seasonGen.generateCategory(i,this.latestRawText,a,"season",e)}revert(){this.seasonGen.revert()}openPlayers(){this.dialog.openCategoryPlayers()}static \u0275fac=function(i){return new(i||t)(x(ie),x(oe),x(I),x(le),x(z))};static \u0275cmp=D({type:t,selectors:[["app-category-season-generator"]],decls:2,vars:3,consts:[["class","w-full text-black dark:text-white",4,"ngIf"],[1,"w-full","text-black","dark:text-white"],[1,"mb-4"],["routerLink","/admin-portal",1,"back-button"],[1,"text-xl","font-semibold"],[1,"text-sm","!mb-2"],[1,"space-y-4",3,"formGroup"],[1,"grid","grid-cols-1","md:grid-cols-3","gap-4"],[1,"flex","flex-col"],[1,"label"],["formControlName","measure",1,"input"],[3,"value",4,"ngFor","ngForOf"],["formControlName","statType",1,"input"],["type","number","formControlName","threshold",1,"input"],["formControlName","condition",1,"input"],[1,"mt-4"],[1,"grid","grid-cols-1","gap-4"],[1,"input","h-auto","whitespace-pre-wrap","p-2","border","min-h-[50px]","bg-white","dark:bg-black","border-black",3,"innerHTML"],["formControlName","generatedDescription","readonly","",1,"input"],["formControlName","generatedCode","readonly","",1,"input"],[4,"ngIf"],[3,"value"],["class","button-primary w-full",3,"disabled","click",4,"ngIf"],["class","space-y-2",4,"ngIf"],[1,"button-primary","w-full",3,"click","disabled"],[1,"space-y-2"],[1,"flex","flex-col","items-center","justify-center","border","border-black","dark:border-white","rounded-md","p-2"],[1,"clever-font-medium"],[1,"flex","gap-2"],[1,"button-primary","w-full",3,"click"],[1,"button-blue","w-full",3,"click"],["class","button-green w-full",3,"click",4,"ngIf"],[1,"button-green","w-full",3,"click"]],template:function(i,a){i&1&&(b(0,ve,47,7,"div",0),A(1,"async")),i&2&&l("ngIf",j(1,1,a.categoryGenerate$))},dependencies:[H,M,R,O,re,Q,te,ne,W,X,ee,J,K,Y,Z,q,B],encapsulation:2})}return t})();export{Le as CategorySeasonGeneratorComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.