ng-bootstrap.umd.js 519 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444
  1. (function (global, factory) {
  2. typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@angular/forms'), require('rxjs'), require('rxjs/operators')) :
  3. typeof define === 'function' && define.amd ? define('ngb', ['exports', '@angular/core', '@angular/common', '@angular/forms', 'rxjs', 'rxjs/operators'], factory) :
  4. (global = global || self, factory(global.ngb = {}, global.ng.core, global.ng.common, global.ng.forms, global.rxjs, global.rxjs.operators));
  5. }(this, function (exports, core, common, forms, rxjs, operators) { 'use strict';
  6. /*! *****************************************************************************
  7. Copyright (c) Microsoft Corporation. All rights reserved.
  8. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  9. this file except in compliance with the License. You may obtain a copy of the
  10. License at http://www.apache.org/licenses/LICENSE-2.0
  11. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  12. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  13. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  14. MERCHANTABLITY OR NON-INFRINGEMENT.
  15. See the Apache Version 2.0 License for specific language governing permissions
  16. and limitations under the License.
  17. ***************************************************************************** */
  18. /* global Reflect, Promise */
  19. var extendStatics = function(d, b) {
  20. extendStatics = Object.setPrototypeOf ||
  21. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  22. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  23. return extendStatics(d, b);
  24. };
  25. function __extends(d, b) {
  26. extendStatics(d, b);
  27. function __() { this.constructor = d; }
  28. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  29. }
  30. var __assign = function() {
  31. __assign = Object.assign || function __assign(t) {
  32. for (var s, i = 1, n = arguments.length; i < n; i++) {
  33. s = arguments[i];
  34. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  35. }
  36. return t;
  37. };
  38. return __assign.apply(this, arguments);
  39. };
  40. function __values(o) {
  41. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  42. if (m) return m.call(o);
  43. return {
  44. next: function () {
  45. if (o && i >= o.length) o = void 0;
  46. return { value: o && o[i++], done: !o };
  47. }
  48. };
  49. }
  50. function __read(o, n) {
  51. var m = typeof Symbol === "function" && o[Symbol.iterator];
  52. if (!m) return o;
  53. var i = m.call(o), r, ar = [], e;
  54. try {
  55. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  56. }
  57. catch (error) { e = { error: error }; }
  58. finally {
  59. try {
  60. if (r && !r.done && (m = i["return"])) m.call(i);
  61. }
  62. finally { if (e) throw e.error; }
  63. }
  64. return ar;
  65. }
  66. /**
  67. * @fileoverview added by tsickle
  68. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  69. */
  70. /**
  71. * @param {?} value
  72. * @return {?}
  73. */
  74. function toInteger(value) {
  75. return parseInt("" + value, 10);
  76. }
  77. /**
  78. * @param {?} value
  79. * @return {?}
  80. */
  81. function toString(value) {
  82. return (value !== undefined && value !== null) ? "" + value : '';
  83. }
  84. /**
  85. * @param {?} value
  86. * @param {?} max
  87. * @param {?=} min
  88. * @return {?}
  89. */
  90. function getValueInRange(value, max, min) {
  91. if (min === void 0) { min = 0; }
  92. return Math.max(Math.min(value, max), min);
  93. }
  94. /**
  95. * @param {?} value
  96. * @return {?}
  97. */
  98. function isString(value) {
  99. return typeof value === 'string';
  100. }
  101. /**
  102. * @param {?} value
  103. * @return {?}
  104. */
  105. function isNumber(value) {
  106. return !isNaN(toInteger(value));
  107. }
  108. /**
  109. * @param {?} value
  110. * @return {?}
  111. */
  112. function isInteger(value) {
  113. return typeof value === 'number' && isFinite(value) && Math.floor(value) === value;
  114. }
  115. /**
  116. * @param {?} value
  117. * @return {?}
  118. */
  119. function isDefined(value) {
  120. return value !== undefined && value !== null;
  121. }
  122. /**
  123. * @param {?} value
  124. * @return {?}
  125. */
  126. function padNumber(value) {
  127. if (isNumber(value)) {
  128. return ("0" + value).slice(-2);
  129. }
  130. else {
  131. return '';
  132. }
  133. }
  134. /**
  135. * @param {?} text
  136. * @return {?}
  137. */
  138. function regExpEscape(text) {
  139. return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
  140. }
  141. /**
  142. * @param {?} element
  143. * @param {?} className
  144. * @return {?}
  145. */
  146. function hasClassName(element, className) {
  147. return element && element.className && element.className.split &&
  148. element.className.split(/\s+/).indexOf(className) >= 0;
  149. }
  150. if (typeof Element !== 'undefined' && !Element.prototype.closest) {
  151. // Polyfill for ie10+
  152. if (!Element.prototype.matches) {
  153. // IE uses the non-standard name: msMatchesSelector
  154. Element.prototype.matches = ((/** @type {?} */ (Element.prototype))).msMatchesSelector || Element.prototype.webkitMatchesSelector;
  155. }
  156. Element.prototype.closest = (/**
  157. * @param {?} s
  158. * @return {?}
  159. */
  160. function (s) {
  161. /** @type {?} */
  162. var el = this;
  163. if (!document.documentElement.contains(el)) {
  164. return null;
  165. }
  166. do {
  167. if (el.matches(s)) {
  168. return el;
  169. }
  170. el = el.parentElement || el.parentNode;
  171. } while (el !== null && el.nodeType === 1);
  172. return null;
  173. });
  174. }
  175. /**
  176. * @param {?} element
  177. * @param {?} selector
  178. * @return {?}
  179. */
  180. function closest(element, selector) {
  181. if (!selector) {
  182. return null;
  183. }
  184. return element.closest(selector);
  185. }
  186. /**
  187. * @fileoverview added by tsickle
  188. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  189. */
  190. /**
  191. * A configuration service for the [NgbAccordion](#/components/accordion/api#NgbAccordion) component.
  192. *
  193. * You can inject this service, typically in your root component, and customize its properties
  194. * to provide default values for all accordions used in the application.
  195. */
  196. var NgbAccordionConfig = /** @class */ (function () {
  197. function NgbAccordionConfig() {
  198. this.closeOthers = false;
  199. }
  200. NgbAccordionConfig.decorators = [
  201. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  202. ];
  203. /** @nocollapse */ NgbAccordionConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbAccordionConfig_Factory() { return new NgbAccordionConfig(); }, token: NgbAccordionConfig, providedIn: "root" });
  204. return NgbAccordionConfig;
  205. }());
  206. /**
  207. * @fileoverview added by tsickle
  208. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  209. */
  210. /** @type {?} */
  211. var nextId = 0;
  212. /**
  213. * A directive that wraps an accordion panel header with any HTML markup and a toggling button
  214. * marked with [`NgbPanelToggle`](#/components/accordion/api#NgbPanelToggle).
  215. * See the [header customization demo](#/components/accordion/examples#header) for more details.
  216. *
  217. * You can also use [`NgbPanelTitle`](#/components/accordion/api#NgbPanelTitle) to customize only the panel title.
  218. *
  219. * \@since 4.1.0
  220. */
  221. var NgbPanelHeader = /** @class */ (function () {
  222. function NgbPanelHeader(templateRef) {
  223. this.templateRef = templateRef;
  224. }
  225. NgbPanelHeader.decorators = [
  226. { type: core.Directive, args: [{ selector: 'ng-template[ngbPanelHeader]' },] }
  227. ];
  228. /** @nocollapse */
  229. NgbPanelHeader.ctorParameters = function () { return [
  230. { type: core.TemplateRef }
  231. ]; };
  232. return NgbPanelHeader;
  233. }());
  234. /**
  235. * A directive that wraps only the panel title with HTML markup inside.
  236. *
  237. * You can also use [`NgbPanelHeader`](#/components/accordion/api#NgbPanelHeader) to customize the full panel header.
  238. */
  239. var NgbPanelTitle = /** @class */ (function () {
  240. function NgbPanelTitle(templateRef) {
  241. this.templateRef = templateRef;
  242. }
  243. NgbPanelTitle.decorators = [
  244. { type: core.Directive, args: [{ selector: 'ng-template[ngbPanelTitle]' },] }
  245. ];
  246. /** @nocollapse */
  247. NgbPanelTitle.ctorParameters = function () { return [
  248. { type: core.TemplateRef }
  249. ]; };
  250. return NgbPanelTitle;
  251. }());
  252. /**
  253. * A directive that wraps the accordion panel content.
  254. */
  255. var NgbPanelContent = /** @class */ (function () {
  256. function NgbPanelContent(templateRef) {
  257. this.templateRef = templateRef;
  258. }
  259. NgbPanelContent.decorators = [
  260. { type: core.Directive, args: [{ selector: 'ng-template[ngbPanelContent]' },] }
  261. ];
  262. /** @nocollapse */
  263. NgbPanelContent.ctorParameters = function () { return [
  264. { type: core.TemplateRef }
  265. ]; };
  266. return NgbPanelContent;
  267. }());
  268. /**
  269. * A directive that wraps an individual accordion panel with title and collapsible content.
  270. */
  271. var NgbPanel = /** @class */ (function () {
  272. function NgbPanel() {
  273. /**
  274. * If `true`, the panel is disabled an can't be toggled.
  275. */
  276. this.disabled = false;
  277. /**
  278. * An optional id for the panel that must be unique on the page.
  279. *
  280. * If not provided, it will be auto-generated in the `ngb-panel-xxx` format.
  281. */
  282. this.id = "ngb-panel-" + nextId++;
  283. this.isOpen = false;
  284. }
  285. /**
  286. * @return {?}
  287. */
  288. NgbPanel.prototype.ngAfterContentChecked = /**
  289. * @return {?}
  290. */
  291. function () {
  292. // We are using @ContentChildren instead of @ContentChild as in the Angular version being used
  293. // only @ContentChildren allows us to specify the {descendants: false} option.
  294. // Without {descendants: false} we are hitting bugs described in:
  295. // https://github.com/ng-bootstrap/ng-bootstrap/issues/2240
  296. this.titleTpl = this.titleTpls.first;
  297. this.headerTpl = this.headerTpls.first;
  298. this.contentTpl = this.contentTpls.first;
  299. };
  300. NgbPanel.decorators = [
  301. { type: core.Directive, args: [{ selector: 'ngb-panel' },] }
  302. ];
  303. NgbPanel.propDecorators = {
  304. disabled: [{ type: core.Input }],
  305. id: [{ type: core.Input }],
  306. title: [{ type: core.Input }],
  307. type: [{ type: core.Input }],
  308. titleTpls: [{ type: core.ContentChildren, args: [NgbPanelTitle, { descendants: false },] }],
  309. headerTpls: [{ type: core.ContentChildren, args: [NgbPanelHeader, { descendants: false },] }],
  310. contentTpls: [{ type: core.ContentChildren, args: [NgbPanelContent, { descendants: false },] }]
  311. };
  312. return NgbPanel;
  313. }());
  314. /**
  315. * Accordion is a collection of collapsible panels (bootstrap cards).
  316. *
  317. * It can ensure only one panel is opened at a time and allows to customize panel
  318. * headers.
  319. */
  320. var NgbAccordion = /** @class */ (function () {
  321. function NgbAccordion(config) {
  322. /**
  323. * An array or comma separated strings of panel ids that should be opened **initially**.
  324. *
  325. * For subsequent changes use methods like `expand()`, `collapse()`, etc. and
  326. * the `(panelChange)` event.
  327. */
  328. this.activeIds = [];
  329. /**
  330. * If `true`, panel content will be detached from DOM and not simply hidden when the panel is collapsed.
  331. */
  332. this.destroyOnHide = true;
  333. /**
  334. * Event emitted right before the panel toggle happens.
  335. *
  336. * See [NgbPanelChangeEvent](#/components/accordion/api#NgbPanelChangeEvent) for payload details.
  337. */
  338. this.panelChange = new core.EventEmitter();
  339. this.type = config.type;
  340. this.closeOtherPanels = config.closeOthers;
  341. }
  342. /**
  343. * Checks if a panel with a given id is expanded.
  344. */
  345. /**
  346. * Checks if a panel with a given id is expanded.
  347. * @param {?} panelId
  348. * @return {?}
  349. */
  350. NgbAccordion.prototype.isExpanded = /**
  351. * Checks if a panel with a given id is expanded.
  352. * @param {?} panelId
  353. * @return {?}
  354. */
  355. function (panelId) { return this.activeIds.indexOf(panelId) > -1; };
  356. /**
  357. * Expands a panel with a given id.
  358. *
  359. * Has no effect if the panel is already expanded or disabled.
  360. */
  361. /**
  362. * Expands a panel with a given id.
  363. *
  364. * Has no effect if the panel is already expanded or disabled.
  365. * @param {?} panelId
  366. * @return {?}
  367. */
  368. NgbAccordion.prototype.expand = /**
  369. * Expands a panel with a given id.
  370. *
  371. * Has no effect if the panel is already expanded or disabled.
  372. * @param {?} panelId
  373. * @return {?}
  374. */
  375. function (panelId) { this._changeOpenState(this._findPanelById(panelId), true); };
  376. /**
  377. * Expands all panels, if `[closeOthers]` is `false`.
  378. *
  379. * If `[closeOthers]` is `true`, it will expand the first panel, unless there is already a panel opened.
  380. */
  381. /**
  382. * Expands all panels, if `[closeOthers]` is `false`.
  383. *
  384. * If `[closeOthers]` is `true`, it will expand the first panel, unless there is already a panel opened.
  385. * @return {?}
  386. */
  387. NgbAccordion.prototype.expandAll = /**
  388. * Expands all panels, if `[closeOthers]` is `false`.
  389. *
  390. * If `[closeOthers]` is `true`, it will expand the first panel, unless there is already a panel opened.
  391. * @return {?}
  392. */
  393. function () {
  394. var _this = this;
  395. if (this.closeOtherPanels) {
  396. if (this.activeIds.length === 0 && this.panels.length) {
  397. this._changeOpenState(this.panels.first, true);
  398. }
  399. }
  400. else {
  401. this.panels.forEach((/**
  402. * @param {?} panel
  403. * @return {?}
  404. */
  405. function (panel) { return _this._changeOpenState(panel, true); }));
  406. }
  407. };
  408. /**
  409. * Collapses a panel with the given id.
  410. *
  411. * Has no effect if the panel is already collapsed or disabled.
  412. */
  413. /**
  414. * Collapses a panel with the given id.
  415. *
  416. * Has no effect if the panel is already collapsed or disabled.
  417. * @param {?} panelId
  418. * @return {?}
  419. */
  420. NgbAccordion.prototype.collapse = /**
  421. * Collapses a panel with the given id.
  422. *
  423. * Has no effect if the panel is already collapsed or disabled.
  424. * @param {?} panelId
  425. * @return {?}
  426. */
  427. function (panelId) { this._changeOpenState(this._findPanelById(panelId), false); };
  428. /**
  429. * Collapses all opened panels.
  430. */
  431. /**
  432. * Collapses all opened panels.
  433. * @return {?}
  434. */
  435. NgbAccordion.prototype.collapseAll = /**
  436. * Collapses all opened panels.
  437. * @return {?}
  438. */
  439. function () {
  440. var _this = this;
  441. this.panels.forEach((/**
  442. * @param {?} panel
  443. * @return {?}
  444. */
  445. function (panel) { _this._changeOpenState(panel, false); }));
  446. };
  447. /**
  448. * Toggles a panel with the given id.
  449. *
  450. * Has no effect if the panel is disabled.
  451. */
  452. /**
  453. * Toggles a panel with the given id.
  454. *
  455. * Has no effect if the panel is disabled.
  456. * @param {?} panelId
  457. * @return {?}
  458. */
  459. NgbAccordion.prototype.toggle = /**
  460. * Toggles a panel with the given id.
  461. *
  462. * Has no effect if the panel is disabled.
  463. * @param {?} panelId
  464. * @return {?}
  465. */
  466. function (panelId) {
  467. /** @type {?} */
  468. var panel = this._findPanelById(panelId);
  469. if (panel) {
  470. this._changeOpenState(panel, !panel.isOpen);
  471. }
  472. };
  473. /**
  474. * @return {?}
  475. */
  476. NgbAccordion.prototype.ngAfterContentChecked = /**
  477. * @return {?}
  478. */
  479. function () {
  480. var _this = this;
  481. // active id updates
  482. if (isString(this.activeIds)) {
  483. this.activeIds = this.activeIds.split(/\s*,\s*/);
  484. }
  485. // update panels open states
  486. this.panels.forEach((/**
  487. * @param {?} panel
  488. * @return {?}
  489. */
  490. function (panel) { return panel.isOpen = !panel.disabled && _this.activeIds.indexOf(panel.id) > -1; }));
  491. // closeOthers updates
  492. if (this.activeIds.length > 1 && this.closeOtherPanels) {
  493. this._closeOthers(this.activeIds[0]);
  494. this._updateActiveIds();
  495. }
  496. };
  497. /**
  498. * @private
  499. * @param {?} panel
  500. * @param {?} nextState
  501. * @return {?}
  502. */
  503. NgbAccordion.prototype._changeOpenState = /**
  504. * @private
  505. * @param {?} panel
  506. * @param {?} nextState
  507. * @return {?}
  508. */
  509. function (panel, nextState) {
  510. if (panel && !panel.disabled && panel.isOpen !== nextState) {
  511. /** @type {?} */
  512. var defaultPrevented_1 = false;
  513. this.panelChange.emit({ panelId: panel.id, nextState: nextState, preventDefault: (/**
  514. * @return {?}
  515. */
  516. function () { defaultPrevented_1 = true; }) });
  517. if (!defaultPrevented_1) {
  518. panel.isOpen = nextState;
  519. if (nextState && this.closeOtherPanels) {
  520. this._closeOthers(panel.id);
  521. }
  522. this._updateActiveIds();
  523. }
  524. }
  525. };
  526. /**
  527. * @private
  528. * @param {?} panelId
  529. * @return {?}
  530. */
  531. NgbAccordion.prototype._closeOthers = /**
  532. * @private
  533. * @param {?} panelId
  534. * @return {?}
  535. */
  536. function (panelId) {
  537. this.panels.forEach((/**
  538. * @param {?} panel
  539. * @return {?}
  540. */
  541. function (panel) {
  542. if (panel.id !== panelId) {
  543. panel.isOpen = false;
  544. }
  545. }));
  546. };
  547. /**
  548. * @private
  549. * @param {?} panelId
  550. * @return {?}
  551. */
  552. NgbAccordion.prototype._findPanelById = /**
  553. * @private
  554. * @param {?} panelId
  555. * @return {?}
  556. */
  557. function (panelId) { return this.panels.find((/**
  558. * @param {?} p
  559. * @return {?}
  560. */
  561. function (p) { return p.id === panelId; })); };
  562. /**
  563. * @private
  564. * @return {?}
  565. */
  566. NgbAccordion.prototype._updateActiveIds = /**
  567. * @private
  568. * @return {?}
  569. */
  570. function () {
  571. this.activeIds = this.panels.filter((/**
  572. * @param {?} panel
  573. * @return {?}
  574. */
  575. function (panel) { return panel.isOpen && !panel.disabled; })).map((/**
  576. * @param {?} panel
  577. * @return {?}
  578. */
  579. function (panel) { return panel.id; }));
  580. };
  581. NgbAccordion.decorators = [
  582. { type: core.Component, args: [{
  583. selector: 'ngb-accordion',
  584. exportAs: 'ngbAccordion',
  585. encapsulation: core.ViewEncapsulation.None,
  586. host: { 'class': 'accordion', 'role': 'tablist', '[attr.aria-multiselectable]': '!closeOtherPanels' },
  587. template: "\n <ng-template #t ngbPanelHeader let-panel>\n <button class=\"btn btn-link\" [ngbPanelToggle]=\"panel\">\n {{panel.title}}<ng-template [ngTemplateOutlet]=\"panel.titleTpl?.templateRef\"></ng-template>\n </button>\n </ng-template>\n <ng-template ngFor let-panel [ngForOf]=\"panels\">\n <div class=\"card\">\n <div role=\"tab\" id=\"{{panel.id}}-header\" [class]=\"'card-header ' + (panel.type ? 'bg-'+panel.type: type ? 'bg-'+type : '')\">\n <ng-template [ngTemplateOutlet]=\"panel.headerTpl?.templateRef || t\"\n [ngTemplateOutletContext]=\"{$implicit: panel, opened: panel.isOpen}\"></ng-template>\n </div>\n <div id=\"{{panel.id}}\" role=\"tabpanel\" [attr.aria-labelledby]=\"panel.id + '-header'\"\n class=\"collapse\" [class.show]=\"panel.isOpen\" *ngIf=\"!destroyOnHide || panel.isOpen\">\n <div class=\"card-body\">\n <ng-template [ngTemplateOutlet]=\"panel.contentTpl?.templateRef\"></ng-template>\n </div>\n </div>\n </div>\n </ng-template>\n "
  588. }] }
  589. ];
  590. /** @nocollapse */
  591. NgbAccordion.ctorParameters = function () { return [
  592. { type: NgbAccordionConfig }
  593. ]; };
  594. NgbAccordion.propDecorators = {
  595. panels: [{ type: core.ContentChildren, args: [NgbPanel,] }],
  596. activeIds: [{ type: core.Input }],
  597. closeOtherPanels: [{ type: core.Input, args: ['closeOthers',] }],
  598. destroyOnHide: [{ type: core.Input }],
  599. type: [{ type: core.Input }],
  600. panelChange: [{ type: core.Output }]
  601. };
  602. return NgbAccordion;
  603. }());
  604. /**
  605. * A directive to put on a button that toggles panel opening and closing.
  606. *
  607. * To be used inside the [`NgbPanelHeader`](#/components/accordion/api#NgbPanelHeader)
  608. *
  609. * \@since 4.1.0
  610. */
  611. var NgbPanelToggle = /** @class */ (function () {
  612. function NgbPanelToggle(accordion, panel) {
  613. this.accordion = accordion;
  614. this.panel = panel;
  615. }
  616. Object.defineProperty(NgbPanelToggle.prototype, "ngbPanelToggle", {
  617. set: /**
  618. * @param {?} panel
  619. * @return {?}
  620. */
  621. function (panel) {
  622. if (panel) {
  623. this.panel = panel;
  624. }
  625. },
  626. enumerable: true,
  627. configurable: true
  628. });
  629. NgbPanelToggle.decorators = [
  630. { type: core.Directive, args: [{
  631. selector: 'button[ngbPanelToggle]',
  632. host: {
  633. 'type': 'button',
  634. '[disabled]': 'panel.disabled',
  635. '[class.collapsed]': '!panel.isOpen',
  636. '[attr.aria-expanded]': 'panel.isOpen',
  637. '[attr.aria-controls]': 'panel.id',
  638. '(click)': 'accordion.toggle(panel.id)'
  639. }
  640. },] }
  641. ];
  642. /** @nocollapse */
  643. NgbPanelToggle.ctorParameters = function () { return [
  644. { type: NgbAccordion },
  645. { type: NgbPanel, decorators: [{ type: core.Optional }, { type: core.Host }] }
  646. ]; };
  647. NgbPanelToggle.propDecorators = {
  648. ngbPanelToggle: [{ type: core.Input }]
  649. };
  650. return NgbPanelToggle;
  651. }());
  652. /**
  653. * @fileoverview added by tsickle
  654. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  655. */
  656. /** @type {?} */
  657. var NGB_ACCORDION_DIRECTIVES = [NgbAccordion, NgbPanel, NgbPanelTitle, NgbPanelContent, NgbPanelHeader, NgbPanelToggle];
  658. var NgbAccordionModule = /** @class */ (function () {
  659. function NgbAccordionModule() {
  660. }
  661. NgbAccordionModule.decorators = [
  662. { type: core.NgModule, args: [{ declarations: NGB_ACCORDION_DIRECTIVES, exports: NGB_ACCORDION_DIRECTIVES, imports: [common.CommonModule] },] }
  663. ];
  664. return NgbAccordionModule;
  665. }());
  666. /**
  667. * @fileoverview added by tsickle
  668. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  669. */
  670. /**
  671. * A configuration service for the [NgbAlert](#/components/alert/api#NgbAlert) component.
  672. *
  673. * You can inject this service, typically in your root component, and customize its properties
  674. * to provide default values for all alerts used in the application.
  675. */
  676. var NgbAlertConfig = /** @class */ (function () {
  677. function NgbAlertConfig() {
  678. this.dismissible = true;
  679. this.type = 'warning';
  680. }
  681. NgbAlertConfig.decorators = [
  682. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  683. ];
  684. /** @nocollapse */ NgbAlertConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbAlertConfig_Factory() { return new NgbAlertConfig(); }, token: NgbAlertConfig, providedIn: "root" });
  685. return NgbAlertConfig;
  686. }());
  687. /**
  688. * @fileoverview added by tsickle
  689. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  690. */
  691. /**
  692. * Alert is a component to provide contextual feedback messages for user.
  693. *
  694. * It supports several alert types and can be dismissed.
  695. */
  696. var NgbAlert = /** @class */ (function () {
  697. function NgbAlert(config, _renderer, _element) {
  698. this._renderer = _renderer;
  699. this._element = _element;
  700. /**
  701. * An event emitted when the close button is clicked. It has no payload and only relevant for dismissible alerts.
  702. */
  703. this.close = new core.EventEmitter();
  704. this.dismissible = config.dismissible;
  705. this.type = config.type;
  706. }
  707. /**
  708. * @return {?}
  709. */
  710. NgbAlert.prototype.closeHandler = /**
  711. * @return {?}
  712. */
  713. function () { this.close.emit(null); };
  714. /**
  715. * @param {?} changes
  716. * @return {?}
  717. */
  718. NgbAlert.prototype.ngOnChanges = /**
  719. * @param {?} changes
  720. * @return {?}
  721. */
  722. function (changes) {
  723. /** @type {?} */
  724. var typeChange = changes['type'];
  725. if (typeChange && !typeChange.firstChange) {
  726. this._renderer.removeClass(this._element.nativeElement, "alert-" + typeChange.previousValue);
  727. this._renderer.addClass(this._element.nativeElement, "alert-" + typeChange.currentValue);
  728. }
  729. };
  730. /**
  731. * @return {?}
  732. */
  733. NgbAlert.prototype.ngOnInit = /**
  734. * @return {?}
  735. */
  736. function () { this._renderer.addClass(this._element.nativeElement, "alert-" + this.type); };
  737. NgbAlert.decorators = [
  738. { type: core.Component, args: [{
  739. selector: 'ngb-alert',
  740. changeDetection: core.ChangeDetectionStrategy.OnPush,
  741. encapsulation: core.ViewEncapsulation.None,
  742. host: { 'role': 'alert', 'class': 'alert', '[class.alert-dismissible]': 'dismissible' },
  743. template: "\n <ng-content></ng-content>\n <button *ngIf=\"dismissible\" type=\"button\" class=\"close\" aria-label=\"Close\" i18n-aria-label=\"@@ngb.alert.close\"\n (click)=\"closeHandler()\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n ",
  744. styles: ["ngb-alert{display:block}"]
  745. }] }
  746. ];
  747. /** @nocollapse */
  748. NgbAlert.ctorParameters = function () { return [
  749. { type: NgbAlertConfig },
  750. { type: core.Renderer2 },
  751. { type: core.ElementRef }
  752. ]; };
  753. NgbAlert.propDecorators = {
  754. dismissible: [{ type: core.Input }],
  755. type: [{ type: core.Input }],
  756. close: [{ type: core.Output }]
  757. };
  758. return NgbAlert;
  759. }());
  760. /**
  761. * @fileoverview added by tsickle
  762. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  763. */
  764. var NgbAlertModule = /** @class */ (function () {
  765. function NgbAlertModule() {
  766. }
  767. NgbAlertModule.decorators = [
  768. { type: core.NgModule, args: [{ declarations: [NgbAlert], exports: [NgbAlert], imports: [common.CommonModule], entryComponents: [NgbAlert] },] }
  769. ];
  770. return NgbAlertModule;
  771. }());
  772. /**
  773. * @fileoverview added by tsickle
  774. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  775. */
  776. var NgbButtonLabel = /** @class */ (function () {
  777. function NgbButtonLabel() {
  778. }
  779. NgbButtonLabel.decorators = [
  780. { type: core.Directive, args: [{
  781. selector: '[ngbButtonLabel]',
  782. host: { '[class.btn]': 'true', '[class.active]': 'active', '[class.disabled]': 'disabled', '[class.focus]': 'focused' }
  783. },] }
  784. ];
  785. return NgbButtonLabel;
  786. }());
  787. /**
  788. * @fileoverview added by tsickle
  789. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  790. */
  791. /** @type {?} */
  792. var NGB_CHECKBOX_VALUE_ACCESSOR = {
  793. provide: forms.NG_VALUE_ACCESSOR,
  794. useExisting: core.forwardRef((/**
  795. * @return {?}
  796. */
  797. function () { return NgbCheckBox; })),
  798. multi: true
  799. };
  800. /**
  801. * Allows to easily create Bootstrap-style checkbox buttons.
  802. *
  803. * Integrates with forms, so the value of a checked button is bound to the underlying form control
  804. * either in a reactive or template-driven way.
  805. */
  806. var NgbCheckBox = /** @class */ (function () {
  807. function NgbCheckBox(_label, _cd) {
  808. this._label = _label;
  809. this._cd = _cd;
  810. /**
  811. * If `true`, the checkbox button will be disabled
  812. */
  813. this.disabled = false;
  814. /**
  815. * The form control value when the checkbox is checked.
  816. */
  817. this.valueChecked = true;
  818. /**
  819. * The form control value when the checkbox is unchecked.
  820. */
  821. this.valueUnChecked = false;
  822. this.onChange = (/**
  823. * @param {?} _
  824. * @return {?}
  825. */
  826. function (_) { });
  827. this.onTouched = (/**
  828. * @return {?}
  829. */
  830. function () { });
  831. }
  832. Object.defineProperty(NgbCheckBox.prototype, "focused", {
  833. set: /**
  834. * @param {?} isFocused
  835. * @return {?}
  836. */
  837. function (isFocused) {
  838. this._label.focused = isFocused;
  839. if (!isFocused) {
  840. this.onTouched();
  841. }
  842. },
  843. enumerable: true,
  844. configurable: true
  845. });
  846. /**
  847. * @param {?} $event
  848. * @return {?}
  849. */
  850. NgbCheckBox.prototype.onInputChange = /**
  851. * @param {?} $event
  852. * @return {?}
  853. */
  854. function ($event) {
  855. /** @type {?} */
  856. var modelToPropagate = $event.target.checked ? this.valueChecked : this.valueUnChecked;
  857. this.onChange(modelToPropagate);
  858. this.onTouched();
  859. this.writeValue(modelToPropagate);
  860. };
  861. /**
  862. * @param {?} fn
  863. * @return {?}
  864. */
  865. NgbCheckBox.prototype.registerOnChange = /**
  866. * @param {?} fn
  867. * @return {?}
  868. */
  869. function (fn) { this.onChange = fn; };
  870. /**
  871. * @param {?} fn
  872. * @return {?}
  873. */
  874. NgbCheckBox.prototype.registerOnTouched = /**
  875. * @param {?} fn
  876. * @return {?}
  877. */
  878. function (fn) { this.onTouched = fn; };
  879. /**
  880. * @param {?} isDisabled
  881. * @return {?}
  882. */
  883. NgbCheckBox.prototype.setDisabledState = /**
  884. * @param {?} isDisabled
  885. * @return {?}
  886. */
  887. function (isDisabled) {
  888. this.disabled = isDisabled;
  889. this._label.disabled = isDisabled;
  890. };
  891. /**
  892. * @param {?} value
  893. * @return {?}
  894. */
  895. NgbCheckBox.prototype.writeValue = /**
  896. * @param {?} value
  897. * @return {?}
  898. */
  899. function (value) {
  900. this.checked = value === this.valueChecked;
  901. this._label.active = this.checked;
  902. // label won't be updated, if it is inside the OnPush component when [ngModel] changes
  903. this._cd.markForCheck();
  904. };
  905. NgbCheckBox.decorators = [
  906. { type: core.Directive, args: [{
  907. selector: '[ngbButton][type=checkbox]',
  908. host: {
  909. '[checked]': 'checked',
  910. '[disabled]': 'disabled',
  911. '(change)': 'onInputChange($event)',
  912. '(focus)': 'focused = true',
  913. '(blur)': 'focused = false'
  914. },
  915. providers: [NGB_CHECKBOX_VALUE_ACCESSOR]
  916. },] }
  917. ];
  918. /** @nocollapse */
  919. NgbCheckBox.ctorParameters = function () { return [
  920. { type: NgbButtonLabel },
  921. { type: core.ChangeDetectorRef }
  922. ]; };
  923. NgbCheckBox.propDecorators = {
  924. disabled: [{ type: core.Input }],
  925. valueChecked: [{ type: core.Input }],
  926. valueUnChecked: [{ type: core.Input }]
  927. };
  928. return NgbCheckBox;
  929. }());
  930. /**
  931. * @fileoverview added by tsickle
  932. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  933. */
  934. /** @type {?} */
  935. var NGB_RADIO_VALUE_ACCESSOR = {
  936. provide: forms.NG_VALUE_ACCESSOR,
  937. useExisting: core.forwardRef((/**
  938. * @return {?}
  939. */
  940. function () { return NgbRadioGroup; })),
  941. multi: true
  942. };
  943. /** @type {?} */
  944. var nextId$1 = 0;
  945. /**
  946. * Allows to easily create Bootstrap-style radio buttons.
  947. *
  948. * Integrates with forms, so the value of a checked button is bound to the underlying form control
  949. * either in a reactive or template-driven way.
  950. */
  951. var NgbRadioGroup = /** @class */ (function () {
  952. function NgbRadioGroup() {
  953. this._radios = new Set();
  954. this._value = null;
  955. /**
  956. * Name of the radio group applied to radio input elements.
  957. *
  958. * Will be applied to all radio input elements inside the group,
  959. * unless [`NgbRadio`](#/components/buttons/api#NgbRadio)'s specify names themselves.
  960. *
  961. * If not provided, will be generated in the `ngb-radio-xx` format.
  962. */
  963. this.name = "ngb-radio-" + nextId$1++;
  964. this.onChange = (/**
  965. * @param {?} _
  966. * @return {?}
  967. */
  968. function (_) { });
  969. this.onTouched = (/**
  970. * @return {?}
  971. */
  972. function () { });
  973. }
  974. Object.defineProperty(NgbRadioGroup.prototype, "disabled", {
  975. get: /**
  976. * @return {?}
  977. */
  978. function () { return this._disabled; },
  979. set: /**
  980. * @param {?} isDisabled
  981. * @return {?}
  982. */
  983. function (isDisabled) { this.setDisabledState(isDisabled); },
  984. enumerable: true,
  985. configurable: true
  986. });
  987. /**
  988. * @param {?} radio
  989. * @return {?}
  990. */
  991. NgbRadioGroup.prototype.onRadioChange = /**
  992. * @param {?} radio
  993. * @return {?}
  994. */
  995. function (radio) {
  996. this.writeValue(radio.value);
  997. this.onChange(radio.value);
  998. };
  999. /**
  1000. * @return {?}
  1001. */
  1002. NgbRadioGroup.prototype.onRadioValueUpdate = /**
  1003. * @return {?}
  1004. */
  1005. function () { this._updateRadiosValue(); };
  1006. /**
  1007. * @param {?} radio
  1008. * @return {?}
  1009. */
  1010. NgbRadioGroup.prototype.register = /**
  1011. * @param {?} radio
  1012. * @return {?}
  1013. */
  1014. function (radio) { this._radios.add(radio); };
  1015. /**
  1016. * @param {?} fn
  1017. * @return {?}
  1018. */
  1019. NgbRadioGroup.prototype.registerOnChange = /**
  1020. * @param {?} fn
  1021. * @return {?}
  1022. */
  1023. function (fn) { this.onChange = fn; };
  1024. /**
  1025. * @param {?} fn
  1026. * @return {?}
  1027. */
  1028. NgbRadioGroup.prototype.registerOnTouched = /**
  1029. * @param {?} fn
  1030. * @return {?}
  1031. */
  1032. function (fn) { this.onTouched = fn; };
  1033. /**
  1034. * @param {?} isDisabled
  1035. * @return {?}
  1036. */
  1037. NgbRadioGroup.prototype.setDisabledState = /**
  1038. * @param {?} isDisabled
  1039. * @return {?}
  1040. */
  1041. function (isDisabled) {
  1042. this._disabled = isDisabled;
  1043. this._updateRadiosDisabled();
  1044. };
  1045. /**
  1046. * @param {?} radio
  1047. * @return {?}
  1048. */
  1049. NgbRadioGroup.prototype.unregister = /**
  1050. * @param {?} radio
  1051. * @return {?}
  1052. */
  1053. function (radio) { this._radios.delete(radio); };
  1054. /**
  1055. * @param {?} value
  1056. * @return {?}
  1057. */
  1058. NgbRadioGroup.prototype.writeValue = /**
  1059. * @param {?} value
  1060. * @return {?}
  1061. */
  1062. function (value) {
  1063. this._value = value;
  1064. this._updateRadiosValue();
  1065. };
  1066. /**
  1067. * @private
  1068. * @return {?}
  1069. */
  1070. NgbRadioGroup.prototype._updateRadiosValue = /**
  1071. * @private
  1072. * @return {?}
  1073. */
  1074. function () {
  1075. var _this = this;
  1076. this._radios.forEach((/**
  1077. * @param {?} radio
  1078. * @return {?}
  1079. */
  1080. function (radio) { return radio.updateValue(_this._value); }));
  1081. };
  1082. /**
  1083. * @private
  1084. * @return {?}
  1085. */
  1086. NgbRadioGroup.prototype._updateRadiosDisabled = /**
  1087. * @private
  1088. * @return {?}
  1089. */
  1090. function () { this._radios.forEach((/**
  1091. * @param {?} radio
  1092. * @return {?}
  1093. */
  1094. function (radio) { return radio.updateDisabled(); })); };
  1095. NgbRadioGroup.decorators = [
  1096. { type: core.Directive, args: [{ selector: '[ngbRadioGroup]', host: { 'role': 'radiogroup' }, providers: [NGB_RADIO_VALUE_ACCESSOR] },] }
  1097. ];
  1098. NgbRadioGroup.propDecorators = {
  1099. name: [{ type: core.Input }]
  1100. };
  1101. return NgbRadioGroup;
  1102. }());
  1103. /**
  1104. * A directive that marks an input of type "radio" as a part of the
  1105. * [`NgbRadioGroup`](#/components/buttons/api#NgbRadioGroup).
  1106. */
  1107. var NgbRadio = /** @class */ (function () {
  1108. function NgbRadio(_group, _label, _renderer, _element, _cd) {
  1109. this._group = _group;
  1110. this._label = _label;
  1111. this._renderer = _renderer;
  1112. this._element = _element;
  1113. this._cd = _cd;
  1114. this._value = null;
  1115. this._group.register(this);
  1116. this.updateDisabled();
  1117. }
  1118. Object.defineProperty(NgbRadio.prototype, "value", {
  1119. get: /**
  1120. * @return {?}
  1121. */
  1122. function () { return this._value; },
  1123. /**
  1124. * The form control value when current radio button is checked.
  1125. */
  1126. set: /**
  1127. * The form control value when current radio button is checked.
  1128. * @param {?} value
  1129. * @return {?}
  1130. */
  1131. function (value) {
  1132. this._value = value;
  1133. /** @type {?} */
  1134. var stringValue = value ? value.toString() : '';
  1135. this._renderer.setProperty(this._element.nativeElement, 'value', stringValue);
  1136. this._group.onRadioValueUpdate();
  1137. },
  1138. enumerable: true,
  1139. configurable: true
  1140. });
  1141. Object.defineProperty(NgbRadio.prototype, "disabled", {
  1142. get: /**
  1143. * @return {?}
  1144. */
  1145. function () { return this._group.disabled || this._disabled; },
  1146. /**
  1147. * If `true`, current radio button will be disabled.
  1148. */
  1149. set: /**
  1150. * If `true`, current radio button will be disabled.
  1151. * @param {?} isDisabled
  1152. * @return {?}
  1153. */
  1154. function (isDisabled) {
  1155. this._disabled = isDisabled !== false;
  1156. this.updateDisabled();
  1157. },
  1158. enumerable: true,
  1159. configurable: true
  1160. });
  1161. Object.defineProperty(NgbRadio.prototype, "focused", {
  1162. set: /**
  1163. * @param {?} isFocused
  1164. * @return {?}
  1165. */
  1166. function (isFocused) {
  1167. if (this._label) {
  1168. this._label.focused = isFocused;
  1169. }
  1170. if (!isFocused) {
  1171. this._group.onTouched();
  1172. }
  1173. },
  1174. enumerable: true,
  1175. configurable: true
  1176. });
  1177. Object.defineProperty(NgbRadio.prototype, "checked", {
  1178. get: /**
  1179. * @return {?}
  1180. */
  1181. function () { return this._checked; },
  1182. enumerable: true,
  1183. configurable: true
  1184. });
  1185. Object.defineProperty(NgbRadio.prototype, "nameAttr", {
  1186. get: /**
  1187. * @return {?}
  1188. */
  1189. function () { return this.name || this._group.name; },
  1190. enumerable: true,
  1191. configurable: true
  1192. });
  1193. /**
  1194. * @return {?}
  1195. */
  1196. NgbRadio.prototype.ngOnDestroy = /**
  1197. * @return {?}
  1198. */
  1199. function () { this._group.unregister(this); };
  1200. /**
  1201. * @return {?}
  1202. */
  1203. NgbRadio.prototype.onChange = /**
  1204. * @return {?}
  1205. */
  1206. function () { this._group.onRadioChange(this); };
  1207. /**
  1208. * @param {?} value
  1209. * @return {?}
  1210. */
  1211. NgbRadio.prototype.updateValue = /**
  1212. * @param {?} value
  1213. * @return {?}
  1214. */
  1215. function (value) {
  1216. // label won't be updated, if it is inside the OnPush component when [ngModel] changes
  1217. if (this.value !== value) {
  1218. this._cd.markForCheck();
  1219. }
  1220. this._checked = this.value === value;
  1221. this._label.active = this._checked;
  1222. };
  1223. /**
  1224. * @return {?}
  1225. */
  1226. NgbRadio.prototype.updateDisabled = /**
  1227. * @return {?}
  1228. */
  1229. function () { this._label.disabled = this.disabled; };
  1230. NgbRadio.decorators = [
  1231. { type: core.Directive, args: [{
  1232. selector: '[ngbButton][type=radio]',
  1233. host: {
  1234. '[checked]': 'checked',
  1235. '[disabled]': 'disabled',
  1236. '[name]': 'nameAttr',
  1237. '(change)': 'onChange()',
  1238. '(focus)': 'focused = true',
  1239. '(blur)': 'focused = false'
  1240. }
  1241. },] }
  1242. ];
  1243. /** @nocollapse */
  1244. NgbRadio.ctorParameters = function () { return [
  1245. { type: NgbRadioGroup },
  1246. { type: NgbButtonLabel },
  1247. { type: core.Renderer2 },
  1248. { type: core.ElementRef },
  1249. { type: core.ChangeDetectorRef }
  1250. ]; };
  1251. NgbRadio.propDecorators = {
  1252. name: [{ type: core.Input }],
  1253. value: [{ type: core.Input, args: ['value',] }],
  1254. disabled: [{ type: core.Input, args: ['disabled',] }]
  1255. };
  1256. return NgbRadio;
  1257. }());
  1258. /**
  1259. * @fileoverview added by tsickle
  1260. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1261. */
  1262. /** @type {?} */
  1263. var NGB_BUTTON_DIRECTIVES = [NgbButtonLabel, NgbCheckBox, NgbRadioGroup, NgbRadio];
  1264. var NgbButtonsModule = /** @class */ (function () {
  1265. function NgbButtonsModule() {
  1266. }
  1267. NgbButtonsModule.decorators = [
  1268. { type: core.NgModule, args: [{ declarations: NGB_BUTTON_DIRECTIVES, exports: NGB_BUTTON_DIRECTIVES },] }
  1269. ];
  1270. return NgbButtonsModule;
  1271. }());
  1272. /**
  1273. * @fileoverview added by tsickle
  1274. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1275. */
  1276. /**
  1277. * A configuration service for the [NgbCarousel](#/components/carousel/api#NgbCarousel) component.
  1278. *
  1279. * You can inject this service, typically in your root component, and customize its properties
  1280. * to provide default values for all carousels used in the application.
  1281. */
  1282. var NgbCarouselConfig = /** @class */ (function () {
  1283. function NgbCarouselConfig() {
  1284. this.interval = 5000;
  1285. this.wrap = true;
  1286. this.keyboard = true;
  1287. this.pauseOnHover = true;
  1288. this.showNavigationArrows = true;
  1289. this.showNavigationIndicators = true;
  1290. }
  1291. NgbCarouselConfig.decorators = [
  1292. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  1293. ];
  1294. /** @nocollapse */ NgbCarouselConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbCarouselConfig_Factory() { return new NgbCarouselConfig(); }, token: NgbCarouselConfig, providedIn: "root" });
  1295. return NgbCarouselConfig;
  1296. }());
  1297. /**
  1298. * @fileoverview added by tsickle
  1299. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1300. */
  1301. /** @type {?} */
  1302. var nextId$2 = 0;
  1303. /**
  1304. * A directive that wraps the individual carousel slide.
  1305. */
  1306. var NgbSlide = /** @class */ (function () {
  1307. function NgbSlide(tplRef) {
  1308. this.tplRef = tplRef;
  1309. /**
  1310. * Slide id that must be unique for the entire document.
  1311. *
  1312. * If not provided, will be generated in the `ngb-slide-xx` format.
  1313. */
  1314. this.id = "ngb-slide-" + nextId$2++;
  1315. }
  1316. NgbSlide.decorators = [
  1317. { type: core.Directive, args: [{ selector: 'ng-template[ngbSlide]' },] }
  1318. ];
  1319. /** @nocollapse */
  1320. NgbSlide.ctorParameters = function () { return [
  1321. { type: core.TemplateRef }
  1322. ]; };
  1323. NgbSlide.propDecorators = {
  1324. id: [{ type: core.Input }]
  1325. };
  1326. return NgbSlide;
  1327. }());
  1328. /**
  1329. * Carousel is a component to easily create and control slideshows.
  1330. *
  1331. * Allows to set intervals, change the way user interacts with the slides and provides a programmatic API.
  1332. */
  1333. var NgbCarousel = /** @class */ (function () {
  1334. function NgbCarousel(config, _platformId, _ngZone, _cd) {
  1335. this._platformId = _platformId;
  1336. this._ngZone = _ngZone;
  1337. this._cd = _cd;
  1338. this.NgbSlideEventSource = NgbSlideEventSource;
  1339. this._destroy$ = new rxjs.Subject();
  1340. this._interval$ = new rxjs.BehaviorSubject(0);
  1341. this._mouseHover$ = new rxjs.BehaviorSubject(false);
  1342. this._pauseOnHover$ = new rxjs.BehaviorSubject(false);
  1343. this._pause$ = new rxjs.BehaviorSubject(false);
  1344. this._wrap$ = new rxjs.BehaviorSubject(false);
  1345. /**
  1346. * An event emitted right after the slide transition is completed.
  1347. *
  1348. * See [`NgbSlideEvent`](#/components/carousel/api#NgbSlideEvent) for payload details.
  1349. */
  1350. this.slide = new core.EventEmitter();
  1351. this.interval = config.interval;
  1352. this.wrap = config.wrap;
  1353. this.keyboard = config.keyboard;
  1354. this.pauseOnHover = config.pauseOnHover;
  1355. this.showNavigationArrows = config.showNavigationArrows;
  1356. this.showNavigationIndicators = config.showNavigationIndicators;
  1357. }
  1358. Object.defineProperty(NgbCarousel.prototype, "interval", {
  1359. get: /**
  1360. * @return {?}
  1361. */
  1362. function () { return this._interval$.value; },
  1363. /**
  1364. * Time in milliseconds before the next slide is shown.
  1365. */
  1366. set: /**
  1367. * Time in milliseconds before the next slide is shown.
  1368. * @param {?} value
  1369. * @return {?}
  1370. */
  1371. function (value) {
  1372. this._interval$.next(value);
  1373. },
  1374. enumerable: true,
  1375. configurable: true
  1376. });
  1377. Object.defineProperty(NgbCarousel.prototype, "wrap", {
  1378. get: /**
  1379. * @return {?}
  1380. */
  1381. function () { return this._wrap$.value; },
  1382. /**
  1383. * If `true`, will 'wrap' the carousel by switching from the last slide back to the first.
  1384. */
  1385. set: /**
  1386. * If `true`, will 'wrap' the carousel by switching from the last slide back to the first.
  1387. * @param {?} value
  1388. * @return {?}
  1389. */
  1390. function (value) {
  1391. this._wrap$.next(value);
  1392. },
  1393. enumerable: true,
  1394. configurable: true
  1395. });
  1396. Object.defineProperty(NgbCarousel.prototype, "pauseOnHover", {
  1397. get: /**
  1398. * @return {?}
  1399. */
  1400. function () { return this._pauseOnHover$.value; },
  1401. /**
  1402. * If `true`, will pause slide switching when mouse cursor hovers the slide.
  1403. *
  1404. * @since 2.2.0
  1405. */
  1406. set: /**
  1407. * If `true`, will pause slide switching when mouse cursor hovers the slide.
  1408. *
  1409. * \@since 2.2.0
  1410. * @param {?} value
  1411. * @return {?}
  1412. */
  1413. function (value) {
  1414. this._pauseOnHover$.next(value);
  1415. },
  1416. enumerable: true,
  1417. configurable: true
  1418. });
  1419. /**
  1420. * @return {?}
  1421. */
  1422. NgbCarousel.prototype.mouseEnter = /**
  1423. * @return {?}
  1424. */
  1425. function () {
  1426. this._mouseHover$.next(true);
  1427. };
  1428. /**
  1429. * @return {?}
  1430. */
  1431. NgbCarousel.prototype.mouseLeave = /**
  1432. * @return {?}
  1433. */
  1434. function () {
  1435. this._mouseHover$.next(false);
  1436. };
  1437. /**
  1438. * @return {?}
  1439. */
  1440. NgbCarousel.prototype.ngAfterContentInit = /**
  1441. * @return {?}
  1442. */
  1443. function () {
  1444. var _this = this;
  1445. // setInterval() doesn't play well with SSR and protractor,
  1446. // so we should run it in the browser and outside Angular
  1447. if (common.isPlatformBrowser(this._platformId)) {
  1448. this._ngZone.runOutsideAngular((/**
  1449. * @return {?}
  1450. */
  1451. function () {
  1452. /** @type {?} */
  1453. var hasNextSlide$ = rxjs.combineLatest(_this.slide.pipe(operators.map((/**
  1454. * @param {?} slideEvent
  1455. * @return {?}
  1456. */
  1457. function (slideEvent) { return slideEvent.current; })), operators.startWith(_this.activeId)), _this._wrap$, _this.slides.changes.pipe(operators.startWith(null)))
  1458. .pipe(operators.map((/**
  1459. * @param {?} __0
  1460. * @return {?}
  1461. */
  1462. function (_a) {
  1463. var _b = __read(_a, 2), currentSlideId = _b[0], wrap = _b[1];
  1464. /** @type {?} */
  1465. var slideArr = _this.slides.toArray();
  1466. /** @type {?} */
  1467. var currentSlideIdx = _this._getSlideIdxById(currentSlideId);
  1468. return wrap ? slideArr.length > 1 : currentSlideIdx < slideArr.length - 1;
  1469. })), operators.distinctUntilChanged());
  1470. rxjs.combineLatest(_this._pause$, _this._pauseOnHover$, _this._mouseHover$, _this._interval$, hasNextSlide$)
  1471. .pipe(operators.map((/**
  1472. * @param {?} __0
  1473. * @return {?}
  1474. */
  1475. function (_a) {
  1476. var _b = __read(_a, 5), pause = _b[0], pauseOnHover = _b[1], mouseHover = _b[2], interval = _b[3], hasNextSlide = _b[4];
  1477. return ((pause || (pauseOnHover && mouseHover) || !hasNextSlide) ? 0 : interval);
  1478. })), operators.distinctUntilChanged(), operators.switchMap((/**
  1479. * @param {?} interval
  1480. * @return {?}
  1481. */
  1482. function (interval) { return interval > 0 ? rxjs.timer(interval, interval) : rxjs.NEVER; })), operators.takeUntil(_this._destroy$))
  1483. .subscribe((/**
  1484. * @return {?}
  1485. */
  1486. function () { return _this._ngZone.run((/**
  1487. * @return {?}
  1488. */
  1489. function () { return _this.next(NgbSlideEventSource.TIMER); })); }));
  1490. }));
  1491. }
  1492. this.slides.changes.pipe(operators.takeUntil(this._destroy$)).subscribe((/**
  1493. * @return {?}
  1494. */
  1495. function () { return _this._cd.markForCheck(); }));
  1496. };
  1497. /**
  1498. * @return {?}
  1499. */
  1500. NgbCarousel.prototype.ngAfterContentChecked = /**
  1501. * @return {?}
  1502. */
  1503. function () {
  1504. /** @type {?} */
  1505. var activeSlide = this._getSlideById(this.activeId);
  1506. this.activeId = activeSlide ? activeSlide.id : (this.slides.length ? this.slides.first.id : null);
  1507. };
  1508. /**
  1509. * @return {?}
  1510. */
  1511. NgbCarousel.prototype.ngOnDestroy = /**
  1512. * @return {?}
  1513. */
  1514. function () { this._destroy$.next(); };
  1515. /**
  1516. * Navigates to a slide with the specified identifier.
  1517. */
  1518. /**
  1519. * Navigates to a slide with the specified identifier.
  1520. * @param {?} slideId
  1521. * @param {?=} source
  1522. * @return {?}
  1523. */
  1524. NgbCarousel.prototype.select = /**
  1525. * Navigates to a slide with the specified identifier.
  1526. * @param {?} slideId
  1527. * @param {?=} source
  1528. * @return {?}
  1529. */
  1530. function (slideId, source) {
  1531. this._cycleToSelected(slideId, this._getSlideEventDirection(this.activeId, slideId), source);
  1532. };
  1533. /**
  1534. * Navigates to the previous slide.
  1535. */
  1536. /**
  1537. * Navigates to the previous slide.
  1538. * @param {?=} source
  1539. * @return {?}
  1540. */
  1541. NgbCarousel.prototype.prev = /**
  1542. * Navigates to the previous slide.
  1543. * @param {?=} source
  1544. * @return {?}
  1545. */
  1546. function (source) {
  1547. this._cycleToSelected(this._getPrevSlide(this.activeId), NgbSlideEventDirection.RIGHT, source);
  1548. };
  1549. /**
  1550. * Navigates to the next slide.
  1551. */
  1552. /**
  1553. * Navigates to the next slide.
  1554. * @param {?=} source
  1555. * @return {?}
  1556. */
  1557. NgbCarousel.prototype.next = /**
  1558. * Navigates to the next slide.
  1559. * @param {?=} source
  1560. * @return {?}
  1561. */
  1562. function (source) {
  1563. this._cycleToSelected(this._getNextSlide(this.activeId), NgbSlideEventDirection.LEFT, source);
  1564. };
  1565. /**
  1566. * Pauses cycling through the slides.
  1567. */
  1568. /**
  1569. * Pauses cycling through the slides.
  1570. * @return {?}
  1571. */
  1572. NgbCarousel.prototype.pause = /**
  1573. * Pauses cycling through the slides.
  1574. * @return {?}
  1575. */
  1576. function () { this._pause$.next(true); };
  1577. /**
  1578. * Restarts cycling through the slides from left to right.
  1579. */
  1580. /**
  1581. * Restarts cycling through the slides from left to right.
  1582. * @return {?}
  1583. */
  1584. NgbCarousel.prototype.cycle = /**
  1585. * Restarts cycling through the slides from left to right.
  1586. * @return {?}
  1587. */
  1588. function () { this._pause$.next(false); };
  1589. /**
  1590. * @private
  1591. * @param {?} slideIdx
  1592. * @param {?} direction
  1593. * @param {?=} source
  1594. * @return {?}
  1595. */
  1596. NgbCarousel.prototype._cycleToSelected = /**
  1597. * @private
  1598. * @param {?} slideIdx
  1599. * @param {?} direction
  1600. * @param {?=} source
  1601. * @return {?}
  1602. */
  1603. function (slideIdx, direction, source) {
  1604. /** @type {?} */
  1605. var selectedSlide = this._getSlideById(slideIdx);
  1606. if (selectedSlide && selectedSlide.id !== this.activeId) {
  1607. this.slide.emit({ prev: this.activeId, current: selectedSlide.id, direction: direction, paused: this._pause$.value, source: source });
  1608. this.activeId = selectedSlide.id;
  1609. }
  1610. // we get here after the interval fires or any external API call like next(), prev() or select()
  1611. this._cd.markForCheck();
  1612. };
  1613. /**
  1614. * @private
  1615. * @param {?} currentActiveSlideId
  1616. * @param {?} nextActiveSlideId
  1617. * @return {?}
  1618. */
  1619. NgbCarousel.prototype._getSlideEventDirection = /**
  1620. * @private
  1621. * @param {?} currentActiveSlideId
  1622. * @param {?} nextActiveSlideId
  1623. * @return {?}
  1624. */
  1625. function (currentActiveSlideId, nextActiveSlideId) {
  1626. /** @type {?} */
  1627. var currentActiveSlideIdx = this._getSlideIdxById(currentActiveSlideId);
  1628. /** @type {?} */
  1629. var nextActiveSlideIdx = this._getSlideIdxById(nextActiveSlideId);
  1630. return currentActiveSlideIdx > nextActiveSlideIdx ? NgbSlideEventDirection.RIGHT : NgbSlideEventDirection.LEFT;
  1631. };
  1632. /**
  1633. * @private
  1634. * @param {?} slideId
  1635. * @return {?}
  1636. */
  1637. NgbCarousel.prototype._getSlideById = /**
  1638. * @private
  1639. * @param {?} slideId
  1640. * @return {?}
  1641. */
  1642. function (slideId) { return this.slides.find((/**
  1643. * @param {?} slide
  1644. * @return {?}
  1645. */
  1646. function (slide) { return slide.id === slideId; })); };
  1647. /**
  1648. * @private
  1649. * @param {?} slideId
  1650. * @return {?}
  1651. */
  1652. NgbCarousel.prototype._getSlideIdxById = /**
  1653. * @private
  1654. * @param {?} slideId
  1655. * @return {?}
  1656. */
  1657. function (slideId) {
  1658. return this.slides.toArray().indexOf(this._getSlideById(slideId));
  1659. };
  1660. /**
  1661. * @private
  1662. * @param {?} currentSlideId
  1663. * @return {?}
  1664. */
  1665. NgbCarousel.prototype._getNextSlide = /**
  1666. * @private
  1667. * @param {?} currentSlideId
  1668. * @return {?}
  1669. */
  1670. function (currentSlideId) {
  1671. /** @type {?} */
  1672. var slideArr = this.slides.toArray();
  1673. /** @type {?} */
  1674. var currentSlideIdx = this._getSlideIdxById(currentSlideId);
  1675. /** @type {?} */
  1676. var isLastSlide = currentSlideIdx === slideArr.length - 1;
  1677. return isLastSlide ? (this.wrap ? slideArr[0].id : slideArr[slideArr.length - 1].id) :
  1678. slideArr[currentSlideIdx + 1].id;
  1679. };
  1680. /**
  1681. * @private
  1682. * @param {?} currentSlideId
  1683. * @return {?}
  1684. */
  1685. NgbCarousel.prototype._getPrevSlide = /**
  1686. * @private
  1687. * @param {?} currentSlideId
  1688. * @return {?}
  1689. */
  1690. function (currentSlideId) {
  1691. /** @type {?} */
  1692. var slideArr = this.slides.toArray();
  1693. /** @type {?} */
  1694. var currentSlideIdx = this._getSlideIdxById(currentSlideId);
  1695. /** @type {?} */
  1696. var isFirstSlide = currentSlideIdx === 0;
  1697. return isFirstSlide ? (this.wrap ? slideArr[slideArr.length - 1].id : slideArr[0].id) :
  1698. slideArr[currentSlideIdx - 1].id;
  1699. };
  1700. NgbCarousel.decorators = [
  1701. { type: core.Component, args: [{
  1702. selector: 'ngb-carousel',
  1703. exportAs: 'ngbCarousel',
  1704. changeDetection: core.ChangeDetectionStrategy.OnPush,
  1705. encapsulation: core.ViewEncapsulation.None,
  1706. host: {
  1707. 'class': 'carousel slide',
  1708. '[style.display]': '"block"',
  1709. 'tabIndex': '0',
  1710. '(keydown.arrowLeft)': 'keyboard && prev(NgbSlideEventSource.ARROW_LEFT)',
  1711. '(keydown.arrowRight)': 'keyboard && next(NgbSlideEventSource.ARROW_RIGHT)'
  1712. },
  1713. template: "\n <ol class=\"carousel-indicators\" *ngIf=\"showNavigationIndicators\">\n <li *ngFor=\"let slide of slides\" [id]=\"slide.id\" [class.active]=\"slide.id === activeId\"\n (click)=\"select(slide.id, NgbSlideEventSource.INDICATOR)\"></li>\n </ol>\n <div class=\"carousel-inner\">\n <div *ngFor=\"let slide of slides\" class=\"carousel-item\" [class.active]=\"slide.id === activeId\">\n <ng-template [ngTemplateOutlet]=\"slide.tplRef\"></ng-template>\n </div>\n </div>\n <a class=\"carousel-control-prev\" role=\"button\" (click)=\"prev(NgbSlideEventSource.ARROW_LEFT)\" *ngIf=\"showNavigationArrows\">\n <span class=\"carousel-control-prev-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.carousel.previous\">Previous</span>\n </a>\n <a class=\"carousel-control-next\" role=\"button\" (click)=\"next(NgbSlideEventSource.ARROW_RIGHT)\" *ngIf=\"showNavigationArrows\">\n <span class=\"carousel-control-next-icon\" aria-hidden=\"true\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.carousel.next\">Next</span>\n </a>\n "
  1714. }] }
  1715. ];
  1716. /** @nocollapse */
  1717. NgbCarousel.ctorParameters = function () { return [
  1718. { type: NgbCarouselConfig },
  1719. { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] }] },
  1720. { type: core.NgZone },
  1721. { type: core.ChangeDetectorRef }
  1722. ]; };
  1723. NgbCarousel.propDecorators = {
  1724. slides: [{ type: core.ContentChildren, args: [NgbSlide,] }],
  1725. activeId: [{ type: core.Input }],
  1726. interval: [{ type: core.Input }],
  1727. wrap: [{ type: core.Input }],
  1728. keyboard: [{ type: core.Input }],
  1729. pauseOnHover: [{ type: core.Input }],
  1730. showNavigationArrows: [{ type: core.Input }],
  1731. showNavigationIndicators: [{ type: core.Input }],
  1732. slide: [{ type: core.Output }],
  1733. mouseEnter: [{ type: core.HostListener, args: ['mouseenter',] }],
  1734. mouseLeave: [{ type: core.HostListener, args: ['mouseleave',] }]
  1735. };
  1736. return NgbCarousel;
  1737. }());
  1738. /** @enum {string} */
  1739. var NgbSlideEventDirection = {
  1740. LEFT: (/** @type {?} */ ('left')),
  1741. RIGHT: (/** @type {?} */ ('right')),
  1742. };
  1743. /** @enum {string} */
  1744. var NgbSlideEventSource = {
  1745. TIMER: 'timer',
  1746. ARROW_LEFT: 'arrowLeft',
  1747. ARROW_RIGHT: 'arrowRight',
  1748. INDICATOR: 'indicator',
  1749. };
  1750. /** @type {?} */
  1751. var NGB_CAROUSEL_DIRECTIVES = [NgbCarousel, NgbSlide];
  1752. /**
  1753. * @fileoverview added by tsickle
  1754. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1755. */
  1756. var NgbCarouselModule = /** @class */ (function () {
  1757. function NgbCarouselModule() {
  1758. }
  1759. NgbCarouselModule.decorators = [
  1760. { type: core.NgModule, args: [{ declarations: NGB_CAROUSEL_DIRECTIVES, exports: NGB_CAROUSEL_DIRECTIVES, imports: [common.CommonModule] },] }
  1761. ];
  1762. return NgbCarouselModule;
  1763. }());
  1764. /**
  1765. * @fileoverview added by tsickle
  1766. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1767. */
  1768. /**
  1769. * A directive to provide a simple way of hiding and showing elements on the page.
  1770. */
  1771. var NgbCollapse = /** @class */ (function () {
  1772. function NgbCollapse() {
  1773. /**
  1774. * If `true`, will collapse the element or show it otherwise.
  1775. */
  1776. this.collapsed = false;
  1777. }
  1778. NgbCollapse.decorators = [
  1779. { type: core.Directive, args: [{
  1780. selector: '[ngbCollapse]',
  1781. exportAs: 'ngbCollapse',
  1782. host: { '[class.collapse]': 'true', '[class.show]': '!collapsed' }
  1783. },] }
  1784. ];
  1785. NgbCollapse.propDecorators = {
  1786. collapsed: [{ type: core.Input, args: ['ngbCollapse',] }]
  1787. };
  1788. return NgbCollapse;
  1789. }());
  1790. /**
  1791. * @fileoverview added by tsickle
  1792. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1793. */
  1794. var NgbCollapseModule = /** @class */ (function () {
  1795. function NgbCollapseModule() {
  1796. }
  1797. NgbCollapseModule.decorators = [
  1798. { type: core.NgModule, args: [{ declarations: [NgbCollapse], exports: [NgbCollapse] },] }
  1799. ];
  1800. return NgbCollapseModule;
  1801. }());
  1802. /**
  1803. * @fileoverview added by tsickle
  1804. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1805. */
  1806. /**
  1807. * A simple class that represents a date that datepicker also uses internally.
  1808. *
  1809. * It is the implementation of the `NgbDateStruct` interface that adds some convenience methods,
  1810. * like `.equals()`, `.before()`, etc.
  1811. *
  1812. * All datepicker APIs consume `NgbDateStruct`, but return `NgbDate`.
  1813. *
  1814. * In many cases it is simpler to manipulate these objects together with
  1815. * [`NgbCalendar`](#/components/datepicker/api#NgbCalendar) than native JS Dates.
  1816. *
  1817. * See the [date format overview](#/components/datepicker/overview#date-model) for more details.
  1818. *
  1819. * \@since 3.0.0
  1820. */
  1821. var /**
  1822. * A simple class that represents a date that datepicker also uses internally.
  1823. *
  1824. * It is the implementation of the `NgbDateStruct` interface that adds some convenience methods,
  1825. * like `.equals()`, `.before()`, etc.
  1826. *
  1827. * All datepicker APIs consume `NgbDateStruct`, but return `NgbDate`.
  1828. *
  1829. * In many cases it is simpler to manipulate these objects together with
  1830. * [`NgbCalendar`](#/components/datepicker/api#NgbCalendar) than native JS Dates.
  1831. *
  1832. * See the [date format overview](#/components/datepicker/overview#date-model) for more details.
  1833. *
  1834. * \@since 3.0.0
  1835. */
  1836. NgbDate = /** @class */ (function () {
  1837. function NgbDate(year, month, day) {
  1838. this.year = isInteger(year) ? year : null;
  1839. this.month = isInteger(month) ? month : null;
  1840. this.day = isInteger(day) ? day : null;
  1841. }
  1842. /**
  1843. * A **static method** that creates a new date object from the `NgbDateStruct`,
  1844. *
  1845. * ex. `NgbDate.from({year: 2000, month: 5, day: 1})`.
  1846. *
  1847. * If the `date` is already of `NgbDate` type, the method will return the same object.
  1848. */
  1849. /**
  1850. * A **static method** that creates a new date object from the `NgbDateStruct`,
  1851. *
  1852. * ex. `NgbDate.from({year: 2000, month: 5, day: 1})`.
  1853. *
  1854. * If the `date` is already of `NgbDate` type, the method will return the same object.
  1855. * @param {?} date
  1856. * @return {?}
  1857. */
  1858. NgbDate.from = /**
  1859. * A **static method** that creates a new date object from the `NgbDateStruct`,
  1860. *
  1861. * ex. `NgbDate.from({year: 2000, month: 5, day: 1})`.
  1862. *
  1863. * If the `date` is already of `NgbDate` type, the method will return the same object.
  1864. * @param {?} date
  1865. * @return {?}
  1866. */
  1867. function (date) {
  1868. if (date instanceof NgbDate) {
  1869. return date;
  1870. }
  1871. return date ? new NgbDate(date.year, date.month, date.day) : null;
  1872. };
  1873. /**
  1874. * Checks if the current date is equal to another date.
  1875. */
  1876. /**
  1877. * Checks if the current date is equal to another date.
  1878. * @param {?} other
  1879. * @return {?}
  1880. */
  1881. NgbDate.prototype.equals = /**
  1882. * Checks if the current date is equal to another date.
  1883. * @param {?} other
  1884. * @return {?}
  1885. */
  1886. function (other) {
  1887. return other && this.year === other.year && this.month === other.month && this.day === other.day;
  1888. };
  1889. /**
  1890. * Checks if the current date is before another date.
  1891. */
  1892. /**
  1893. * Checks if the current date is before another date.
  1894. * @param {?} other
  1895. * @return {?}
  1896. */
  1897. NgbDate.prototype.before = /**
  1898. * Checks if the current date is before another date.
  1899. * @param {?} other
  1900. * @return {?}
  1901. */
  1902. function (other) {
  1903. if (!other) {
  1904. return false;
  1905. }
  1906. if (this.year === other.year) {
  1907. if (this.month === other.month) {
  1908. return this.day === other.day ? false : this.day < other.day;
  1909. }
  1910. else {
  1911. return this.month < other.month;
  1912. }
  1913. }
  1914. else {
  1915. return this.year < other.year;
  1916. }
  1917. };
  1918. /**
  1919. * Checks if the current date is after another date.
  1920. */
  1921. /**
  1922. * Checks if the current date is after another date.
  1923. * @param {?} other
  1924. * @return {?}
  1925. */
  1926. NgbDate.prototype.after = /**
  1927. * Checks if the current date is after another date.
  1928. * @param {?} other
  1929. * @return {?}
  1930. */
  1931. function (other) {
  1932. if (!other) {
  1933. return false;
  1934. }
  1935. if (this.year === other.year) {
  1936. if (this.month === other.month) {
  1937. return this.day === other.day ? false : this.day > other.day;
  1938. }
  1939. else {
  1940. return this.month > other.month;
  1941. }
  1942. }
  1943. else {
  1944. return this.year > other.year;
  1945. }
  1946. };
  1947. return NgbDate;
  1948. }());
  1949. /**
  1950. * @fileoverview added by tsickle
  1951. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  1952. */
  1953. /**
  1954. * @param {?} jsDate
  1955. * @return {?}
  1956. */
  1957. function fromJSDate(jsDate) {
  1958. return new NgbDate(jsDate.getFullYear(), jsDate.getMonth() + 1, jsDate.getDate());
  1959. }
  1960. /**
  1961. * @param {?} date
  1962. * @return {?}
  1963. */
  1964. function toJSDate(date) {
  1965. /** @type {?} */
  1966. var jsDate = new Date(date.year, date.month - 1, date.day, 12);
  1967. // this is done avoid 30 -> 1930 conversion
  1968. if (!isNaN(jsDate.getTime())) {
  1969. jsDate.setFullYear(date.year);
  1970. }
  1971. return jsDate;
  1972. }
  1973. /**
  1974. * @return {?}
  1975. */
  1976. function NGB_DATEPICKER_CALENDAR_FACTORY() {
  1977. return new NgbCalendarGregorian();
  1978. }
  1979. /**
  1980. * A service that represents the calendar used by the datepicker.
  1981. *
  1982. * The default implementation uses the Gregorian calendar. You can inject it in your own
  1983. * implementations if necessary to simplify `NgbDate` calculations.
  1984. * @abstract
  1985. */
  1986. var NgbCalendar = /** @class */ (function () {
  1987. function NgbCalendar() {
  1988. }
  1989. NgbCalendar.decorators = [
  1990. { type: core.Injectable, args: [{ providedIn: 'root', useFactory: NGB_DATEPICKER_CALENDAR_FACTORY },] }
  1991. ];
  1992. /** @nocollapse */ NgbCalendar.ngInjectableDef = core.ɵɵdefineInjectable({ factory: NGB_DATEPICKER_CALENDAR_FACTORY, token: NgbCalendar, providedIn: "root" });
  1993. return NgbCalendar;
  1994. }());
  1995. var NgbCalendarGregorian = /** @class */ (function (_super) {
  1996. __extends(NgbCalendarGregorian, _super);
  1997. function NgbCalendarGregorian() {
  1998. return _super !== null && _super.apply(this, arguments) || this;
  1999. }
  2000. /**
  2001. * @return {?}
  2002. */
  2003. NgbCalendarGregorian.prototype.getDaysPerWeek = /**
  2004. * @return {?}
  2005. */
  2006. function () { return 7; };
  2007. /**
  2008. * @return {?}
  2009. */
  2010. NgbCalendarGregorian.prototype.getMonths = /**
  2011. * @return {?}
  2012. */
  2013. function () { return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; };
  2014. /**
  2015. * @return {?}
  2016. */
  2017. NgbCalendarGregorian.prototype.getWeeksPerMonth = /**
  2018. * @return {?}
  2019. */
  2020. function () { return 6; };
  2021. /**
  2022. * @param {?} date
  2023. * @param {?=} period
  2024. * @param {?=} number
  2025. * @return {?}
  2026. */
  2027. NgbCalendarGregorian.prototype.getNext = /**
  2028. * @param {?} date
  2029. * @param {?=} period
  2030. * @param {?=} number
  2031. * @return {?}
  2032. */
  2033. function (date, period, number) {
  2034. if (period === void 0) { period = 'd'; }
  2035. if (number === void 0) { number = 1; }
  2036. /** @type {?} */
  2037. var jsDate = toJSDate(date);
  2038. /** @type {?} */
  2039. var checkMonth = true;
  2040. /** @type {?} */
  2041. var expectedMonth = jsDate.getMonth();
  2042. switch (period) {
  2043. case 'y':
  2044. jsDate.setFullYear(jsDate.getFullYear() + number);
  2045. break;
  2046. case 'm':
  2047. expectedMonth += number;
  2048. jsDate.setMonth(expectedMonth);
  2049. expectedMonth = expectedMonth % 12;
  2050. if (expectedMonth < 0) {
  2051. expectedMonth = expectedMonth + 12;
  2052. }
  2053. break;
  2054. case 'd':
  2055. jsDate.setDate(jsDate.getDate() + number);
  2056. checkMonth = false;
  2057. break;
  2058. default:
  2059. return date;
  2060. }
  2061. if (checkMonth && jsDate.getMonth() !== expectedMonth) {
  2062. // this means the destination month has less days than the initial month
  2063. // let's go back to the end of the previous month:
  2064. jsDate.setDate(0);
  2065. }
  2066. return fromJSDate(jsDate);
  2067. };
  2068. /**
  2069. * @param {?} date
  2070. * @param {?=} period
  2071. * @param {?=} number
  2072. * @return {?}
  2073. */
  2074. NgbCalendarGregorian.prototype.getPrev = /**
  2075. * @param {?} date
  2076. * @param {?=} period
  2077. * @param {?=} number
  2078. * @return {?}
  2079. */
  2080. function (date, period, number) {
  2081. if (period === void 0) { period = 'd'; }
  2082. if (number === void 0) { number = 1; }
  2083. return this.getNext(date, period, -number);
  2084. };
  2085. /**
  2086. * @param {?} date
  2087. * @return {?}
  2088. */
  2089. NgbCalendarGregorian.prototype.getWeekday = /**
  2090. * @param {?} date
  2091. * @return {?}
  2092. */
  2093. function (date) {
  2094. /** @type {?} */
  2095. var jsDate = toJSDate(date);
  2096. /** @type {?} */
  2097. var day = jsDate.getDay();
  2098. // in JS Date Sun=0, in ISO 8601 Sun=7
  2099. return day === 0 ? 7 : day;
  2100. };
  2101. /**
  2102. * @param {?} week
  2103. * @param {?} firstDayOfWeek
  2104. * @return {?}
  2105. */
  2106. NgbCalendarGregorian.prototype.getWeekNumber = /**
  2107. * @param {?} week
  2108. * @param {?} firstDayOfWeek
  2109. * @return {?}
  2110. */
  2111. function (week, firstDayOfWeek) {
  2112. // in JS Date Sun=0, in ISO 8601 Sun=7
  2113. if (firstDayOfWeek === 7) {
  2114. firstDayOfWeek = 0;
  2115. }
  2116. /** @type {?} */
  2117. var thursdayIndex = (4 + 7 - firstDayOfWeek) % 7;
  2118. /** @type {?} */
  2119. var date = week[thursdayIndex];
  2120. /** @type {?} */
  2121. var jsDate = toJSDate(date);
  2122. jsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday
  2123. // Thursday
  2124. /** @type {?} */
  2125. var time = jsDate.getTime();
  2126. jsDate.setMonth(0); // Compare with Jan 1
  2127. jsDate.setDate(1);
  2128. return Math.floor(Math.round((time - jsDate.getTime()) / 86400000) / 7) + 1;
  2129. };
  2130. /**
  2131. * @return {?}
  2132. */
  2133. NgbCalendarGregorian.prototype.getToday = /**
  2134. * @return {?}
  2135. */
  2136. function () { return fromJSDate(new Date()); };
  2137. /**
  2138. * @param {?} date
  2139. * @return {?}
  2140. */
  2141. NgbCalendarGregorian.prototype.isValid = /**
  2142. * @param {?} date
  2143. * @return {?}
  2144. */
  2145. function (date) {
  2146. if (!date || !isInteger(date.year) || !isInteger(date.month) || !isInteger(date.day)) {
  2147. return false;
  2148. }
  2149. // year 0 doesn't exist in Gregorian calendar
  2150. if (date.year === 0) {
  2151. return false;
  2152. }
  2153. /** @type {?} */
  2154. var jsDate = toJSDate(date);
  2155. return !isNaN(jsDate.getTime()) && jsDate.getFullYear() === date.year && jsDate.getMonth() + 1 === date.month &&
  2156. jsDate.getDate() === date.day;
  2157. };
  2158. NgbCalendarGregorian.decorators = [
  2159. { type: core.Injectable }
  2160. ];
  2161. return NgbCalendarGregorian;
  2162. }(NgbCalendar));
  2163. /**
  2164. * @fileoverview added by tsickle
  2165. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2166. */
  2167. /**
  2168. * @param {?} prev
  2169. * @param {?} next
  2170. * @return {?}
  2171. */
  2172. function isChangedDate(prev, next) {
  2173. return !dateComparator(prev, next);
  2174. }
  2175. /**
  2176. * @param {?} prev
  2177. * @param {?} next
  2178. * @return {?}
  2179. */
  2180. function isChangedMonth(prev, next) {
  2181. return !prev && !next ? false : !prev || !next ? true : prev.year !== next.year || prev.month !== next.month;
  2182. }
  2183. /**
  2184. * @param {?} prev
  2185. * @param {?} next
  2186. * @return {?}
  2187. */
  2188. function dateComparator(prev, next) {
  2189. return (!prev && !next) || (!!prev && !!next && prev.equals(next));
  2190. }
  2191. /**
  2192. * @param {?} minDate
  2193. * @param {?} maxDate
  2194. * @return {?}
  2195. */
  2196. function checkMinBeforeMax(minDate, maxDate) {
  2197. if (maxDate && minDate && maxDate.before(minDate)) {
  2198. throw new Error("'maxDate' " + maxDate + " should be greater than 'minDate' " + minDate);
  2199. }
  2200. }
  2201. /**
  2202. * @param {?} date
  2203. * @param {?} minDate
  2204. * @param {?} maxDate
  2205. * @return {?}
  2206. */
  2207. function checkDateInRange(date, minDate, maxDate) {
  2208. if (date && minDate && date.before(minDate)) {
  2209. return minDate;
  2210. }
  2211. if (date && maxDate && date.after(maxDate)) {
  2212. return maxDate;
  2213. }
  2214. return date;
  2215. }
  2216. /**
  2217. * @param {?} date
  2218. * @param {?} state
  2219. * @return {?}
  2220. */
  2221. function isDateSelectable(date, state) {
  2222. var minDate = state.minDate, maxDate = state.maxDate, disabled = state.disabled, markDisabled = state.markDisabled;
  2223. // clang-format off
  2224. return !(!isDefined(date) ||
  2225. disabled ||
  2226. (markDisabled && markDisabled(date, { year: date.year, month: date.month })) ||
  2227. (minDate && date.before(minDate)) ||
  2228. (maxDate && date.after(maxDate)));
  2229. // clang-format on
  2230. }
  2231. /**
  2232. * @param {?} calendar
  2233. * @param {?} date
  2234. * @param {?} minDate
  2235. * @param {?} maxDate
  2236. * @return {?}
  2237. */
  2238. function generateSelectBoxMonths(calendar, date, minDate, maxDate) {
  2239. if (!date) {
  2240. return [];
  2241. }
  2242. /** @type {?} */
  2243. var months = calendar.getMonths(date.year);
  2244. if (minDate && date.year === minDate.year) {
  2245. /** @type {?} */
  2246. var index = months.findIndex((/**
  2247. * @param {?} month
  2248. * @return {?}
  2249. */
  2250. function (month) { return month === minDate.month; }));
  2251. months = months.slice(index);
  2252. }
  2253. if (maxDate && date.year === maxDate.year) {
  2254. /** @type {?} */
  2255. var index = months.findIndex((/**
  2256. * @param {?} month
  2257. * @return {?}
  2258. */
  2259. function (month) { return month === maxDate.month; }));
  2260. months = months.slice(0, index + 1);
  2261. }
  2262. return months;
  2263. }
  2264. /**
  2265. * @param {?} date
  2266. * @param {?} minDate
  2267. * @param {?} maxDate
  2268. * @return {?}
  2269. */
  2270. function generateSelectBoxYears(date, minDate, maxDate) {
  2271. if (!date) {
  2272. return [];
  2273. }
  2274. /** @type {?} */
  2275. var start = minDate ? Math.max(minDate.year, date.year - 500) : date.year - 10;
  2276. /** @type {?} */
  2277. var end = maxDate ? Math.min(maxDate.year, date.year + 500) : date.year + 10;
  2278. /** @type {?} */
  2279. var length = end - start + 1;
  2280. /** @type {?} */
  2281. var numbers = Array(length);
  2282. for (var i = 0; i < length; i++) {
  2283. numbers[i] = start + i;
  2284. }
  2285. return numbers;
  2286. }
  2287. /**
  2288. * @param {?} calendar
  2289. * @param {?} date
  2290. * @param {?} maxDate
  2291. * @return {?}
  2292. */
  2293. function nextMonthDisabled(calendar, date, maxDate) {
  2294. /** @type {?} */
  2295. var nextDate = Object.assign(calendar.getNext(date, 'm'), { day: 1 });
  2296. return maxDate && nextDate.after(maxDate);
  2297. }
  2298. /**
  2299. * @param {?} calendar
  2300. * @param {?} date
  2301. * @param {?} minDate
  2302. * @return {?}
  2303. */
  2304. function prevMonthDisabled(calendar, date, minDate) {
  2305. /** @type {?} */
  2306. var prevDate = Object.assign(calendar.getPrev(date, 'm'), { day: 1 });
  2307. return minDate && (prevDate.year === minDate.year && prevDate.month < minDate.month ||
  2308. prevDate.year < minDate.year && minDate.month === 1);
  2309. }
  2310. /**
  2311. * @param {?} calendar
  2312. * @param {?} date
  2313. * @param {?} state
  2314. * @param {?} i18n
  2315. * @param {?} force
  2316. * @return {?}
  2317. */
  2318. function buildMonths(calendar, date, state, i18n, force) {
  2319. var displayMonths = state.displayMonths, months = state.months;
  2320. // move old months to a temporary array
  2321. /** @type {?} */
  2322. var monthsToReuse = months.splice(0, months.length);
  2323. // generate new first dates, nullify or reuse months
  2324. /** @type {?} */
  2325. var firstDates = Array.from({ length: displayMonths }, (/**
  2326. * @param {?} _
  2327. * @param {?} i
  2328. * @return {?}
  2329. */
  2330. function (_, i) {
  2331. /** @type {?} */
  2332. var firstDate = Object.assign(calendar.getNext(date, 'm', i), { day: 1 });
  2333. months[i] = null;
  2334. if (!force) {
  2335. /** @type {?} */
  2336. var reusedIndex = monthsToReuse.findIndex((/**
  2337. * @param {?} month
  2338. * @return {?}
  2339. */
  2340. function (month) { return month.firstDate.equals(firstDate); }));
  2341. // move reused month back to months
  2342. if (reusedIndex !== -1) {
  2343. months[i] = monthsToReuse.splice(reusedIndex, 1)[0];
  2344. }
  2345. }
  2346. return firstDate;
  2347. }));
  2348. // rebuild nullified months
  2349. firstDates.forEach((/**
  2350. * @param {?} firstDate
  2351. * @param {?} i
  2352. * @return {?}
  2353. */
  2354. function (firstDate, i) {
  2355. if (months[i] === null) {
  2356. months[i] = buildMonth(calendar, firstDate, state, i18n, monthsToReuse.shift() || (/** @type {?} */ ({})));
  2357. }
  2358. }));
  2359. return months;
  2360. }
  2361. /**
  2362. * @param {?} calendar
  2363. * @param {?} date
  2364. * @param {?} state
  2365. * @param {?} i18n
  2366. * @param {?=} month
  2367. * @return {?}
  2368. */
  2369. function buildMonth(calendar, date, state, i18n, month) {
  2370. if (month === void 0) { month = (/** @type {?} */ ({})); }
  2371. var dayTemplateData = state.dayTemplateData, minDate = state.minDate, maxDate = state.maxDate, firstDayOfWeek = state.firstDayOfWeek, markDisabled = state.markDisabled, outsideDays = state.outsideDays;
  2372. /** @type {?} */
  2373. var calendarToday = calendar.getToday();
  2374. month.firstDate = null;
  2375. month.lastDate = null;
  2376. month.number = date.month;
  2377. month.year = date.year;
  2378. month.weeks = month.weeks || [];
  2379. month.weekdays = month.weekdays || [];
  2380. date = getFirstViewDate(calendar, date, firstDayOfWeek);
  2381. // month has weeks
  2382. for (var week = 0; week < calendar.getWeeksPerMonth(); week++) {
  2383. /** @type {?} */
  2384. var weekObject = month.weeks[week];
  2385. if (!weekObject) {
  2386. weekObject = month.weeks[week] = { number: 0, days: [], collapsed: true };
  2387. }
  2388. /** @type {?} */
  2389. var days = weekObject.days;
  2390. // week has days
  2391. for (var day = 0; day < calendar.getDaysPerWeek(); day++) {
  2392. if (week === 0) {
  2393. month.weekdays[day] = calendar.getWeekday(date);
  2394. }
  2395. /** @type {?} */
  2396. var newDate = new NgbDate(date.year, date.month, date.day);
  2397. /** @type {?} */
  2398. var nextDate = calendar.getNext(newDate);
  2399. /** @type {?} */
  2400. var ariaLabel = i18n.getDayAriaLabel(newDate);
  2401. // marking date as disabled
  2402. /** @type {?} */
  2403. var disabled = !!((minDate && newDate.before(minDate)) || (maxDate && newDate.after(maxDate)));
  2404. if (!disabled && markDisabled) {
  2405. disabled = markDisabled(newDate, { month: month.number, year: month.year });
  2406. }
  2407. // today
  2408. /** @type {?} */
  2409. var today = newDate.equals(calendarToday);
  2410. // adding user-provided data to the context
  2411. /** @type {?} */
  2412. var contextUserData = dayTemplateData ? dayTemplateData(newDate, { month: month.number, year: month.year }) : undefined;
  2413. // saving first date of the month
  2414. if (month.firstDate === null && newDate.month === month.number) {
  2415. month.firstDate = newDate;
  2416. }
  2417. // saving last date of the month
  2418. if (newDate.month === month.number && nextDate.month !== month.number) {
  2419. month.lastDate = newDate;
  2420. }
  2421. /** @type {?} */
  2422. var dayObject = days[day];
  2423. if (!dayObject) {
  2424. dayObject = days[day] = (/** @type {?} */ ({}));
  2425. }
  2426. dayObject.date = newDate;
  2427. dayObject.context = Object.assign(dayObject.context || {}, {
  2428. $implicit: newDate,
  2429. date: newDate,
  2430. data: contextUserData,
  2431. currentMonth: month.number,
  2432. currentYear: month.year, disabled: disabled,
  2433. focused: false,
  2434. selected: false, today: today
  2435. });
  2436. dayObject.tabindex = -1;
  2437. dayObject.ariaLabel = ariaLabel;
  2438. dayObject.hidden = false;
  2439. date = nextDate;
  2440. }
  2441. weekObject.number = calendar.getWeekNumber(days.map((/**
  2442. * @param {?} day
  2443. * @return {?}
  2444. */
  2445. function (day) { return day.date; })), firstDayOfWeek);
  2446. // marking week as collapsed
  2447. weekObject.collapsed = outsideDays === 'collapsed' && days[0].date.month !== month.number &&
  2448. days[days.length - 1].date.month !== month.number;
  2449. }
  2450. return month;
  2451. }
  2452. /**
  2453. * @param {?} calendar
  2454. * @param {?} date
  2455. * @param {?} firstDayOfWeek
  2456. * @return {?}
  2457. */
  2458. function getFirstViewDate(calendar, date, firstDayOfWeek) {
  2459. /** @type {?} */
  2460. var daysPerWeek = calendar.getDaysPerWeek();
  2461. /** @type {?} */
  2462. var firstMonthDate = new NgbDate(date.year, date.month, 1);
  2463. /** @type {?} */
  2464. var dayOfWeek = calendar.getWeekday(firstMonthDate) % daysPerWeek;
  2465. return calendar.getPrev(firstMonthDate, 'd', (daysPerWeek + dayOfWeek - firstDayOfWeek) % daysPerWeek);
  2466. }
  2467. /**
  2468. * @fileoverview added by tsickle
  2469. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2470. */
  2471. /**
  2472. * @param {?} locale
  2473. * @return {?}
  2474. */
  2475. function NGB_DATEPICKER_18N_FACTORY(locale) {
  2476. return new NgbDatepickerI18nDefault(locale);
  2477. }
  2478. /**
  2479. * A service supplying i18n data to the datepicker component.
  2480. *
  2481. * The default implementation of this service uses the Angular locale and registered locale data for
  2482. * weekdays and month names (as explained in the Angular i18n guide).
  2483. *
  2484. * It also provides a way to i18n data that depends on calendar calculations, like aria labels, day, week and year
  2485. * numerals. For other static labels the datepicker uses the default Angular i18n.
  2486. *
  2487. * See the [i18n demo](#/components/datepicker/examples#i18n) and
  2488. * [Hebrew calendar demo](#/components/datepicker/calendars#hebrew) on how to extend this class and define
  2489. * a custom provider for i18n.
  2490. * @abstract
  2491. */
  2492. var NgbDatepickerI18n = /** @class */ (function () {
  2493. function NgbDatepickerI18n() {
  2494. }
  2495. /**
  2496. * Returns the textual representation of a day that is rendered in a day cell.
  2497. *
  2498. * @since 3.0.0
  2499. */
  2500. /**
  2501. * Returns the textual representation of a day that is rendered in a day cell.
  2502. *
  2503. * \@since 3.0.0
  2504. * @param {?} date
  2505. * @return {?}
  2506. */
  2507. NgbDatepickerI18n.prototype.getDayNumerals = /**
  2508. * Returns the textual representation of a day that is rendered in a day cell.
  2509. *
  2510. * \@since 3.0.0
  2511. * @param {?} date
  2512. * @return {?}
  2513. */
  2514. function (date) { return "" + date.day; };
  2515. /**
  2516. * Returns the textual representation of a week number rendered by datepicker.
  2517. *
  2518. * @since 3.0.0
  2519. */
  2520. /**
  2521. * Returns the textual representation of a week number rendered by datepicker.
  2522. *
  2523. * \@since 3.0.0
  2524. * @param {?} weekNumber
  2525. * @return {?}
  2526. */
  2527. NgbDatepickerI18n.prototype.getWeekNumerals = /**
  2528. * Returns the textual representation of a week number rendered by datepicker.
  2529. *
  2530. * \@since 3.0.0
  2531. * @param {?} weekNumber
  2532. * @return {?}
  2533. */
  2534. function (weekNumber) { return "" + weekNumber; };
  2535. /**
  2536. * Returns the textual representation of a year that is rendered in the datepicker year select box.
  2537. *
  2538. * @since 3.0.0
  2539. */
  2540. /**
  2541. * Returns the textual representation of a year that is rendered in the datepicker year select box.
  2542. *
  2543. * \@since 3.0.0
  2544. * @param {?} year
  2545. * @return {?}
  2546. */
  2547. NgbDatepickerI18n.prototype.getYearNumerals = /**
  2548. * Returns the textual representation of a year that is rendered in the datepicker year select box.
  2549. *
  2550. * \@since 3.0.0
  2551. * @param {?} year
  2552. * @return {?}
  2553. */
  2554. function (year) { return "" + year; };
  2555. NgbDatepickerI18n.decorators = [
  2556. { type: core.Injectable, args: [{ providedIn: 'root', useFactory: NGB_DATEPICKER_18N_FACTORY, deps: [core.LOCALE_ID] },] }
  2557. ];
  2558. /** @nocollapse */ NgbDatepickerI18n.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbDatepickerI18n_Factory() { return NGB_DATEPICKER_18N_FACTORY(core.ɵɵinject(core.LOCALE_ID)); }, token: NgbDatepickerI18n, providedIn: "root" });
  2559. return NgbDatepickerI18n;
  2560. }());
  2561. var NgbDatepickerI18nDefault = /** @class */ (function (_super) {
  2562. __extends(NgbDatepickerI18nDefault, _super);
  2563. function NgbDatepickerI18nDefault(_locale) {
  2564. var _this = _super.call(this) || this;
  2565. _this._locale = _locale;
  2566. /** @type {?} */
  2567. var weekdaysStartingOnSunday = common.getLocaleDayNames(_locale, common.FormStyle.Standalone, common.TranslationWidth.Short);
  2568. _this._weekdaysShort = weekdaysStartingOnSunday.map((/**
  2569. * @param {?} day
  2570. * @param {?} index
  2571. * @return {?}
  2572. */
  2573. function (day, index) { return weekdaysStartingOnSunday[(index + 1) % 7]; }));
  2574. _this._monthsShort = common.getLocaleMonthNames(_locale, common.FormStyle.Standalone, common.TranslationWidth.Abbreviated);
  2575. _this._monthsFull = common.getLocaleMonthNames(_locale, common.FormStyle.Standalone, common.TranslationWidth.Wide);
  2576. return _this;
  2577. }
  2578. /**
  2579. * @param {?} weekday
  2580. * @return {?}
  2581. */
  2582. NgbDatepickerI18nDefault.prototype.getWeekdayShortName = /**
  2583. * @param {?} weekday
  2584. * @return {?}
  2585. */
  2586. function (weekday) { return this._weekdaysShort[weekday - 1]; };
  2587. /**
  2588. * @param {?} month
  2589. * @return {?}
  2590. */
  2591. NgbDatepickerI18nDefault.prototype.getMonthShortName = /**
  2592. * @param {?} month
  2593. * @return {?}
  2594. */
  2595. function (month) { return this._monthsShort[month - 1]; };
  2596. /**
  2597. * @param {?} month
  2598. * @return {?}
  2599. */
  2600. NgbDatepickerI18nDefault.prototype.getMonthFullName = /**
  2601. * @param {?} month
  2602. * @return {?}
  2603. */
  2604. function (month) { return this._monthsFull[month - 1]; };
  2605. /**
  2606. * @param {?} date
  2607. * @return {?}
  2608. */
  2609. NgbDatepickerI18nDefault.prototype.getDayAriaLabel = /**
  2610. * @param {?} date
  2611. * @return {?}
  2612. */
  2613. function (date) {
  2614. /** @type {?} */
  2615. var jsDate = new Date(date.year, date.month - 1, date.day);
  2616. return common.formatDate(jsDate, 'fullDate', this._locale);
  2617. };
  2618. NgbDatepickerI18nDefault.decorators = [
  2619. { type: core.Injectable }
  2620. ];
  2621. /** @nocollapse */
  2622. NgbDatepickerI18nDefault.ctorParameters = function () { return [
  2623. { type: String, decorators: [{ type: core.Inject, args: [core.LOCALE_ID,] }] }
  2624. ]; };
  2625. return NgbDatepickerI18nDefault;
  2626. }(NgbDatepickerI18n));
  2627. /**
  2628. * @fileoverview added by tsickle
  2629. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  2630. */
  2631. var NgbDatepickerService = /** @class */ (function () {
  2632. function NgbDatepickerService(_calendar, _i18n) {
  2633. var _this = this;
  2634. this._calendar = _calendar;
  2635. this._i18n = _i18n;
  2636. this._VALIDATORS = {
  2637. dayTemplateData: (/**
  2638. * @param {?} dayTemplateData
  2639. * @return {?}
  2640. */
  2641. function (dayTemplateData) {
  2642. if (_this._state.dayTemplateData !== dayTemplateData) {
  2643. return { dayTemplateData: dayTemplateData };
  2644. }
  2645. }),
  2646. displayMonths: (/**
  2647. * @param {?} displayMonths
  2648. * @return {?}
  2649. */
  2650. function (displayMonths) {
  2651. displayMonths = toInteger(displayMonths);
  2652. if (isInteger(displayMonths) && displayMonths > 0 && _this._state.displayMonths !== displayMonths) {
  2653. return { displayMonths: displayMonths };
  2654. }
  2655. }),
  2656. disabled: (/**
  2657. * @param {?} disabled
  2658. * @return {?}
  2659. */
  2660. function (disabled) {
  2661. if (_this._state.disabled !== disabled) {
  2662. return { disabled: disabled };
  2663. }
  2664. }),
  2665. firstDayOfWeek: (/**
  2666. * @param {?} firstDayOfWeek
  2667. * @return {?}
  2668. */
  2669. function (firstDayOfWeek) {
  2670. firstDayOfWeek = toInteger(firstDayOfWeek);
  2671. if (isInteger(firstDayOfWeek) && firstDayOfWeek >= 0 && _this._state.firstDayOfWeek !== firstDayOfWeek) {
  2672. return { firstDayOfWeek: firstDayOfWeek };
  2673. }
  2674. }),
  2675. focusVisible: (/**
  2676. * @param {?} focusVisible
  2677. * @return {?}
  2678. */
  2679. function (focusVisible) {
  2680. if (_this._state.focusVisible !== focusVisible && !_this._state.disabled) {
  2681. return { focusVisible: focusVisible };
  2682. }
  2683. }),
  2684. markDisabled: (/**
  2685. * @param {?} markDisabled
  2686. * @return {?}
  2687. */
  2688. function (markDisabled) {
  2689. if (_this._state.markDisabled !== markDisabled) {
  2690. return { markDisabled: markDisabled };
  2691. }
  2692. }),
  2693. maxDate: (/**
  2694. * @param {?} date
  2695. * @return {?}
  2696. */
  2697. function (date) {
  2698. /** @type {?} */
  2699. var maxDate = _this.toValidDate(date, null);
  2700. if (isChangedDate(_this._state.maxDate, maxDate)) {
  2701. return { maxDate: maxDate };
  2702. }
  2703. }),
  2704. minDate: (/**
  2705. * @param {?} date
  2706. * @return {?}
  2707. */
  2708. function (date) {
  2709. /** @type {?} */
  2710. var minDate = _this.toValidDate(date, null);
  2711. if (isChangedDate(_this._state.minDate, minDate)) {
  2712. return { minDate: minDate };
  2713. }
  2714. }),
  2715. navigation: (/**
  2716. * @param {?} navigation
  2717. * @return {?}
  2718. */
  2719. function (navigation) {
  2720. if (_this._state.navigation !== navigation) {
  2721. return { navigation: navigation };
  2722. }
  2723. }),
  2724. outsideDays: (/**
  2725. * @param {?} outsideDays
  2726. * @return {?}
  2727. */
  2728. function (outsideDays) {
  2729. if (_this._state.outsideDays !== outsideDays) {
  2730. return { outsideDays: outsideDays };
  2731. }
  2732. })
  2733. };
  2734. this._model$ = new rxjs.Subject();
  2735. this._dateSelect$ = new rxjs.Subject();
  2736. this._state = {
  2737. disabled: false,
  2738. displayMonths: 1,
  2739. firstDayOfWeek: 1,
  2740. focusVisible: false,
  2741. months: [],
  2742. navigation: 'select',
  2743. outsideDays: 'visible',
  2744. prevDisabled: false,
  2745. nextDisabled: false,
  2746. selectBoxes: { years: [], months: [] },
  2747. selectedDate: null
  2748. };
  2749. }
  2750. Object.defineProperty(NgbDatepickerService.prototype, "model$", {
  2751. get: /**
  2752. * @return {?}
  2753. */
  2754. function () { return this._model$.pipe(operators.filter((/**
  2755. * @param {?} model
  2756. * @return {?}
  2757. */
  2758. function (model) { return model.months.length > 0; }))); },
  2759. enumerable: true,
  2760. configurable: true
  2761. });
  2762. Object.defineProperty(NgbDatepickerService.prototype, "dateSelect$", {
  2763. get: /**
  2764. * @return {?}
  2765. */
  2766. function () { return this._dateSelect$.pipe(operators.filter((/**
  2767. * @param {?} date
  2768. * @return {?}
  2769. */
  2770. function (date) { return date !== null; }))); },
  2771. enumerable: true,
  2772. configurable: true
  2773. });
  2774. /**
  2775. * @param {?} options
  2776. * @return {?}
  2777. */
  2778. NgbDatepickerService.prototype.set = /**
  2779. * @param {?} options
  2780. * @return {?}
  2781. */
  2782. function (options) {
  2783. var _this = this;
  2784. /** @type {?} */
  2785. var patch = Object.keys(options)
  2786. .map((/**
  2787. * @param {?} key
  2788. * @return {?}
  2789. */
  2790. function (key) { return _this._VALIDATORS[key](options[key]); }))
  2791. .reduce((/**
  2792. * @param {?} obj
  2793. * @param {?} part
  2794. * @return {?}
  2795. */
  2796. function (obj, part) { return (__assign({}, obj, part)); }), {});
  2797. if (Object.keys(patch).length > 0) {
  2798. this._nextState(patch);
  2799. }
  2800. };
  2801. /**
  2802. * @param {?} date
  2803. * @return {?}
  2804. */
  2805. NgbDatepickerService.prototype.focus = /**
  2806. * @param {?} date
  2807. * @return {?}
  2808. */
  2809. function (date) {
  2810. if (!this._state.disabled && this._calendar.isValid(date) && isChangedDate(this._state.focusDate, date)) {
  2811. this._nextState({ focusDate: date });
  2812. }
  2813. };
  2814. /**
  2815. * @return {?}
  2816. */
  2817. NgbDatepickerService.prototype.focusSelect = /**
  2818. * @return {?}
  2819. */
  2820. function () {
  2821. if (isDateSelectable(this._state.focusDate, this._state)) {
  2822. this.select(this._state.focusDate, { emitEvent: true });
  2823. }
  2824. };
  2825. /**
  2826. * @param {?} date
  2827. * @return {?}
  2828. */
  2829. NgbDatepickerService.prototype.open = /**
  2830. * @param {?} date
  2831. * @return {?}
  2832. */
  2833. function (date) {
  2834. /** @type {?} */
  2835. var firstDate = this.toValidDate(date, this._calendar.getToday());
  2836. if (!this._state.disabled && (!this._state.firstDate || isChangedMonth(this._state.firstDate, date))) {
  2837. this._nextState({ firstDate: firstDate });
  2838. }
  2839. };
  2840. /**
  2841. * @param {?} date
  2842. * @param {?=} options
  2843. * @return {?}
  2844. */
  2845. NgbDatepickerService.prototype.select = /**
  2846. * @param {?} date
  2847. * @param {?=} options
  2848. * @return {?}
  2849. */
  2850. function (date, options) {
  2851. if (options === void 0) { options = {}; }
  2852. /** @type {?} */
  2853. var selectedDate = this.toValidDate(date, null);
  2854. if (!this._state.disabled) {
  2855. if (isChangedDate(this._state.selectedDate, selectedDate)) {
  2856. this._nextState({ selectedDate: selectedDate });
  2857. }
  2858. if (options.emitEvent && isDateSelectable(selectedDate, this._state)) {
  2859. this._dateSelect$.next(selectedDate);
  2860. }
  2861. }
  2862. };
  2863. /**
  2864. * @param {?} date
  2865. * @param {?=} defaultValue
  2866. * @return {?}
  2867. */
  2868. NgbDatepickerService.prototype.toValidDate = /**
  2869. * @param {?} date
  2870. * @param {?=} defaultValue
  2871. * @return {?}
  2872. */
  2873. function (date, defaultValue) {
  2874. /** @type {?} */
  2875. var ngbDate = NgbDate.from(date);
  2876. if (defaultValue === undefined) {
  2877. defaultValue = this._calendar.getToday();
  2878. }
  2879. return this._calendar.isValid(ngbDate) ? ngbDate : defaultValue;
  2880. };
  2881. /**
  2882. * @private
  2883. * @param {?} patch
  2884. * @return {?}
  2885. */
  2886. NgbDatepickerService.prototype._nextState = /**
  2887. * @private
  2888. * @param {?} patch
  2889. * @return {?}
  2890. */
  2891. function (patch) {
  2892. /** @type {?} */
  2893. var newState = this._updateState(patch);
  2894. this._patchContexts(newState);
  2895. this._state = newState;
  2896. this._model$.next(this._state);
  2897. };
  2898. /**
  2899. * @private
  2900. * @param {?} state
  2901. * @return {?}
  2902. */
  2903. NgbDatepickerService.prototype._patchContexts = /**
  2904. * @private
  2905. * @param {?} state
  2906. * @return {?}
  2907. */
  2908. function (state) {
  2909. var months = state.months, displayMonths = state.displayMonths, selectedDate = state.selectedDate, focusDate = state.focusDate, focusVisible = state.focusVisible, disabled = state.disabled, outsideDays = state.outsideDays;
  2910. state.months.forEach((/**
  2911. * @param {?} month
  2912. * @return {?}
  2913. */
  2914. function (month) {
  2915. month.weeks.forEach((/**
  2916. * @param {?} week
  2917. * @return {?}
  2918. */
  2919. function (week) {
  2920. week.days.forEach((/**
  2921. * @param {?} day
  2922. * @return {?}
  2923. */
  2924. function (day) {
  2925. // patch focus flag
  2926. if (focusDate) {
  2927. day.context.focused = focusDate.equals(day.date) && focusVisible;
  2928. }
  2929. // calculating tabindex
  2930. day.tabindex = !disabled && day.date.equals(focusDate) && focusDate.month === month.number ? 0 : -1;
  2931. // override context disabled
  2932. if (disabled === true) {
  2933. day.context.disabled = true;
  2934. }
  2935. // patch selection flag
  2936. if (selectedDate !== undefined) {
  2937. day.context.selected = selectedDate !== null && selectedDate.equals(day.date);
  2938. }
  2939. // visibility
  2940. if (month.number !== day.date.month) {
  2941. day.hidden = outsideDays === 'hidden' || outsideDays === 'collapsed' ||
  2942. (displayMonths > 1 && day.date.after(months[0].firstDate) &&
  2943. day.date.before(months[displayMonths - 1].lastDate));
  2944. }
  2945. }));
  2946. }));
  2947. }));
  2948. };
  2949. /**
  2950. * @private
  2951. * @param {?} patch
  2952. * @return {?}
  2953. */
  2954. NgbDatepickerService.prototype._updateState = /**
  2955. * @private
  2956. * @param {?} patch
  2957. * @return {?}
  2958. */
  2959. function (patch) {
  2960. // patching fields
  2961. /** @type {?} */
  2962. var state = Object.assign({}, this._state, patch);
  2963. /** @type {?} */
  2964. var startDate = state.firstDate;
  2965. // min/max dates changed
  2966. if ('minDate' in patch || 'maxDate' in patch) {
  2967. checkMinBeforeMax(state.minDate, state.maxDate);
  2968. state.focusDate = checkDateInRange(state.focusDate, state.minDate, state.maxDate);
  2969. state.firstDate = checkDateInRange(state.firstDate, state.minDate, state.maxDate);
  2970. startDate = state.focusDate;
  2971. }
  2972. // disabled
  2973. if ('disabled' in patch) {
  2974. state.focusVisible = false;
  2975. }
  2976. // initial rebuild via 'select()'
  2977. if ('selectedDate' in patch && this._state.months.length === 0) {
  2978. startDate = state.selectedDate;
  2979. }
  2980. // terminate early if only focus visibility was changed
  2981. if ('focusVisible' in patch) {
  2982. return state;
  2983. }
  2984. // focus date changed
  2985. if ('focusDate' in patch) {
  2986. state.focusDate = checkDateInRange(state.focusDate, state.minDate, state.maxDate);
  2987. startDate = state.focusDate;
  2988. // nothing to rebuild if only focus changed and it is still visible
  2989. if (state.months.length !== 0 && !state.focusDate.before(state.firstDate) &&
  2990. !state.focusDate.after(state.lastDate)) {
  2991. return state;
  2992. }
  2993. }
  2994. // first date changed
  2995. if ('firstDate' in patch) {
  2996. state.firstDate = checkDateInRange(state.firstDate, state.minDate, state.maxDate);
  2997. startDate = state.firstDate;
  2998. }
  2999. // rebuilding months
  3000. if (startDate) {
  3001. /** @type {?} */
  3002. var forceRebuild = 'dayTemplateData' in patch || 'firstDayOfWeek' in patch || 'markDisabled' in patch ||
  3003. 'minDate' in patch || 'maxDate' in patch || 'disabled' in patch || 'outsideDays' in patch;
  3004. /** @type {?} */
  3005. var months = buildMonths(this._calendar, startDate, state, this._i18n, forceRebuild);
  3006. // updating months and boundary dates
  3007. state.months = months;
  3008. state.firstDate = months.length > 0 ? months[0].firstDate : undefined;
  3009. state.lastDate = months.length > 0 ? months[months.length - 1].lastDate : undefined;
  3010. // reset selected date if 'markDisabled' returns true
  3011. if ('selectedDate' in patch && !isDateSelectable(state.selectedDate, state)) {
  3012. state.selectedDate = null;
  3013. }
  3014. // adjusting focus after months were built
  3015. if ('firstDate' in patch) {
  3016. if (state.focusDate === undefined || state.focusDate.before(state.firstDate) ||
  3017. state.focusDate.after(state.lastDate)) {
  3018. state.focusDate = startDate;
  3019. }
  3020. }
  3021. // adjusting months/years for the select box navigation
  3022. /** @type {?} */
  3023. var yearChanged = !this._state.firstDate || this._state.firstDate.year !== state.firstDate.year;
  3024. /** @type {?} */
  3025. var monthChanged = !this._state.firstDate || this._state.firstDate.month !== state.firstDate.month;
  3026. if (state.navigation === 'select') {
  3027. // years -> boundaries (min/max were changed)
  3028. if ('minDate' in patch || 'maxDate' in patch || state.selectBoxes.years.length === 0 || yearChanged) {
  3029. state.selectBoxes.years = generateSelectBoxYears(state.firstDate, state.minDate, state.maxDate);
  3030. }
  3031. // months -> when current year or boundaries change
  3032. if ('minDate' in patch || 'maxDate' in patch || state.selectBoxes.months.length === 0 || yearChanged) {
  3033. state.selectBoxes.months =
  3034. generateSelectBoxMonths(this._calendar, state.firstDate, state.minDate, state.maxDate);
  3035. }
  3036. }
  3037. else {
  3038. state.selectBoxes = { years: [], months: [] };
  3039. }
  3040. // updating navigation arrows -> boundaries change (min/max) or month/year changes
  3041. if ((state.navigation === 'arrows' || state.navigation === 'select') &&
  3042. (monthChanged || yearChanged || 'minDate' in patch || 'maxDate' in patch || 'disabled' in patch)) {
  3043. state.prevDisabled = state.disabled || prevMonthDisabled(this._calendar, state.firstDate, state.minDate);
  3044. state.nextDisabled = state.disabled || nextMonthDisabled(this._calendar, state.lastDate, state.maxDate);
  3045. }
  3046. }
  3047. return state;
  3048. };
  3049. NgbDatepickerService.decorators = [
  3050. { type: core.Injectable }
  3051. ];
  3052. /** @nocollapse */
  3053. NgbDatepickerService.ctorParameters = function () { return [
  3054. { type: NgbCalendar },
  3055. { type: NgbDatepickerI18n }
  3056. ]; };
  3057. return NgbDatepickerService;
  3058. }());
  3059. /**
  3060. * @fileoverview added by tsickle
  3061. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3062. */
  3063. /** @enum {number} */
  3064. var Key = {
  3065. Tab: 9,
  3066. Enter: 13,
  3067. Escape: 27,
  3068. Space: 32,
  3069. PageUp: 33,
  3070. PageDown: 34,
  3071. End: 35,
  3072. Home: 36,
  3073. ArrowLeft: 37,
  3074. ArrowUp: 38,
  3075. ArrowRight: 39,
  3076. ArrowDown: 40,
  3077. };
  3078. Key[Key.Tab] = 'Tab';
  3079. Key[Key.Enter] = 'Enter';
  3080. Key[Key.Escape] = 'Escape';
  3081. Key[Key.Space] = 'Space';
  3082. Key[Key.PageUp] = 'PageUp';
  3083. Key[Key.PageDown] = 'PageDown';
  3084. Key[Key.End] = 'End';
  3085. Key[Key.Home] = 'Home';
  3086. Key[Key.ArrowLeft] = 'ArrowLeft';
  3087. Key[Key.ArrowUp] = 'ArrowUp';
  3088. Key[Key.ArrowRight] = 'ArrowRight';
  3089. Key[Key.ArrowDown] = 'ArrowDown';
  3090. /**
  3091. * @fileoverview added by tsickle
  3092. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3093. */
  3094. /**
  3095. * A service that represents the keyboard navigation.
  3096. *
  3097. * Default keyboard shortcuts [are documented in the overview](#/components/datepicker/overview#keyboard-shortcuts)
  3098. *
  3099. * \@since 5.2.0
  3100. */
  3101. var NgbDatepickerKeyboardService = /** @class */ (function () {
  3102. function NgbDatepickerKeyboardService() {
  3103. }
  3104. /**
  3105. * Processes a keyboard event.
  3106. */
  3107. /**
  3108. * Processes a keyboard event.
  3109. * @param {?} event
  3110. * @param {?} datepicker
  3111. * @param {?} calendar
  3112. * @return {?}
  3113. */
  3114. NgbDatepickerKeyboardService.prototype.processKey = /**
  3115. * Processes a keyboard event.
  3116. * @param {?} event
  3117. * @param {?} datepicker
  3118. * @param {?} calendar
  3119. * @return {?}
  3120. */
  3121. function (event, datepicker, calendar) {
  3122. /** @type {?} */
  3123. var state = datepicker.state;
  3124. // tslint:disable-next-line:deprecation
  3125. switch (event.which) {
  3126. case Key.PageUp:
  3127. datepicker.focusDate(calendar.getPrev(state.focusedDate, event.shiftKey ? 'y' : 'm', 1));
  3128. break;
  3129. case Key.PageDown:
  3130. datepicker.focusDate(calendar.getNext(state.focusedDate, event.shiftKey ? 'y' : 'm', 1));
  3131. break;
  3132. case Key.End:
  3133. datepicker.focusDate(event.shiftKey ? state.maxDate : state.lastDate);
  3134. break;
  3135. case Key.Home:
  3136. datepicker.focusDate(event.shiftKey ? state.minDate : state.firstDate);
  3137. break;
  3138. case Key.ArrowLeft:
  3139. datepicker.focusDate(calendar.getPrev(state.focusedDate, 'd', 1));
  3140. break;
  3141. case Key.ArrowUp:
  3142. datepicker.focusDate(calendar.getPrev(state.focusedDate, 'd', calendar.getDaysPerWeek()));
  3143. break;
  3144. case Key.ArrowRight:
  3145. datepicker.focusDate(calendar.getNext(state.focusedDate, 'd', 1));
  3146. break;
  3147. case Key.ArrowDown:
  3148. datepicker.focusDate(calendar.getNext(state.focusedDate, 'd', calendar.getDaysPerWeek()));
  3149. break;
  3150. case Key.Enter:
  3151. case Key.Space:
  3152. datepicker.focusSelect();
  3153. break;
  3154. default:
  3155. return;
  3156. }
  3157. event.preventDefault();
  3158. event.stopPropagation();
  3159. };
  3160. NgbDatepickerKeyboardService.decorators = [
  3161. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  3162. ];
  3163. /** @nocollapse */ NgbDatepickerKeyboardService.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbDatepickerKeyboardService_Factory() { return new NgbDatepickerKeyboardService(); }, token: NgbDatepickerKeyboardService, providedIn: "root" });
  3164. return NgbDatepickerKeyboardService;
  3165. }());
  3166. /**
  3167. * @fileoverview added by tsickle
  3168. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3169. */
  3170. /** @enum {number} */
  3171. var NavigationEvent = {
  3172. PREV: 0,
  3173. NEXT: 1,
  3174. };
  3175. NavigationEvent[NavigationEvent.PREV] = 'PREV';
  3176. NavigationEvent[NavigationEvent.NEXT] = 'NEXT';
  3177. /**
  3178. * @fileoverview added by tsickle
  3179. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3180. */
  3181. /**
  3182. * A configuration service for the [`NgbDatepicker`](#/components/datepicker/api#NgbDatepicker) component.
  3183. *
  3184. * You can inject this service, typically in your root component, and customize the values of its properties in
  3185. * order to provide default values for all the datepickers used in the application.
  3186. */
  3187. var NgbDatepickerConfig = /** @class */ (function () {
  3188. function NgbDatepickerConfig() {
  3189. this.displayMonths = 1;
  3190. this.firstDayOfWeek = 1;
  3191. this.navigation = 'select';
  3192. this.outsideDays = 'visible';
  3193. this.showWeekdays = true;
  3194. this.showWeekNumbers = false;
  3195. }
  3196. NgbDatepickerConfig.decorators = [
  3197. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  3198. ];
  3199. /** @nocollapse */ NgbDatepickerConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbDatepickerConfig_Factory() { return new NgbDatepickerConfig(); }, token: NgbDatepickerConfig, providedIn: "root" });
  3200. return NgbDatepickerConfig;
  3201. }());
  3202. /**
  3203. * @fileoverview added by tsickle
  3204. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3205. */
  3206. /**
  3207. * @return {?}
  3208. */
  3209. function NGB_DATEPICKER_DATE_ADAPTER_FACTORY() {
  3210. return new NgbDateStructAdapter();
  3211. }
  3212. /**
  3213. * An abstract service that does the conversion between the internal datepicker `NgbDateStruct` model and
  3214. * any provided user date model `D`, ex. a string, a native date, etc.
  3215. *
  3216. * The adapter is used **only** for conversion when binding datepicker to a form control,
  3217. * ex. `[(ngModel)]="userDateModel"`. Here `userDateModel` can be of any type.
  3218. *
  3219. * The default datepicker implementation assumes we use `NgbDateStruct` as a user model.
  3220. *
  3221. * See the [date format overview](#/components/datepicker/overview#date-model) for more details
  3222. * and the [custom adapter demo](#/components/datepicker/examples#adapter) for an example.
  3223. * @abstract
  3224. * @template D
  3225. */
  3226. var NgbDateAdapter = /** @class */ (function () {
  3227. function NgbDateAdapter() {
  3228. }
  3229. NgbDateAdapter.decorators = [
  3230. { type: core.Injectable, args: [{ providedIn: 'root', useFactory: NGB_DATEPICKER_DATE_ADAPTER_FACTORY },] }
  3231. ];
  3232. /** @nocollapse */ NgbDateAdapter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: NGB_DATEPICKER_DATE_ADAPTER_FACTORY, token: NgbDateAdapter, providedIn: "root" });
  3233. return NgbDateAdapter;
  3234. }());
  3235. var NgbDateStructAdapter = /** @class */ (function (_super) {
  3236. __extends(NgbDateStructAdapter, _super);
  3237. function NgbDateStructAdapter() {
  3238. return _super !== null && _super.apply(this, arguments) || this;
  3239. }
  3240. /**
  3241. * Converts a NgbDateStruct value into NgbDateStruct value
  3242. */
  3243. /**
  3244. * Converts a NgbDateStruct value into NgbDateStruct value
  3245. * @param {?} date
  3246. * @return {?}
  3247. */
  3248. NgbDateStructAdapter.prototype.fromModel = /**
  3249. * Converts a NgbDateStruct value into NgbDateStruct value
  3250. * @param {?} date
  3251. * @return {?}
  3252. */
  3253. function (date) {
  3254. return (date && isInteger(date.year) && isInteger(date.month) && isInteger(date.day)) ?
  3255. { year: date.year, month: date.month, day: date.day } :
  3256. null;
  3257. };
  3258. /**
  3259. * Converts a NgbDateStruct value into NgbDateStruct value
  3260. */
  3261. /**
  3262. * Converts a NgbDateStruct value into NgbDateStruct value
  3263. * @param {?} date
  3264. * @return {?}
  3265. */
  3266. NgbDateStructAdapter.prototype.toModel = /**
  3267. * Converts a NgbDateStruct value into NgbDateStruct value
  3268. * @param {?} date
  3269. * @return {?}
  3270. */
  3271. function (date) {
  3272. return (date && isInteger(date.year) && isInteger(date.month) && isInteger(date.day)) ?
  3273. { year: date.year, month: date.month, day: date.day } :
  3274. null;
  3275. };
  3276. NgbDateStructAdapter.decorators = [
  3277. { type: core.Injectable }
  3278. ];
  3279. return NgbDateStructAdapter;
  3280. }(NgbDateAdapter));
  3281. /**
  3282. * @fileoverview added by tsickle
  3283. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3284. */
  3285. /** @type {?} */
  3286. var NGB_DATEPICKER_VALUE_ACCESSOR = {
  3287. provide: forms.NG_VALUE_ACCESSOR,
  3288. useExisting: core.forwardRef((/**
  3289. * @return {?}
  3290. */
  3291. function () { return NgbDatepicker; })),
  3292. multi: true
  3293. };
  3294. /**
  3295. * A highly configurable component that helps you with selecting calendar dates.
  3296. *
  3297. * `NgbDatepicker` is meant to be displayed inline on a page or put inside a popup.
  3298. */
  3299. var NgbDatepicker = /** @class */ (function () {
  3300. function NgbDatepicker(_service, _calendar, i18n, config, _keyboardService, cd, _elementRef, _ngbDateAdapter, _ngZone) {
  3301. var _this = this;
  3302. this._service = _service;
  3303. this._calendar = _calendar;
  3304. this.i18n = i18n;
  3305. this._keyboardService = _keyboardService;
  3306. this._elementRef = _elementRef;
  3307. this._ngbDateAdapter = _ngbDateAdapter;
  3308. this._ngZone = _ngZone;
  3309. this._destroyed$ = new rxjs.Subject();
  3310. this._publicState = (/** @type {?} */ ({}));
  3311. /**
  3312. * An event emitted right before the navigation happens and displayed month changes.
  3313. *
  3314. * See [`NgbDatepickerNavigateEvent`](#/components/datepicker/api#NgbDatepickerNavigateEvent) for the payload info.
  3315. */
  3316. this.navigate = new core.EventEmitter();
  3317. /**
  3318. * An event emitted when user selects a date using keyboard or mouse.
  3319. *
  3320. * The payload of the event is currently selected `NgbDate`.
  3321. *
  3322. * \@since 5.2.0
  3323. */
  3324. this.dateSelect = new core.EventEmitter();
  3325. /**
  3326. * An event emitted when user selects a date using keyboard or mouse.
  3327. *
  3328. * The payload of the event is currently selected `NgbDate`.
  3329. *
  3330. * Please use 'dateSelect' output instead, this will be deprecated in version 6.0 due to collision with native
  3331. * 'select' event.
  3332. */
  3333. this.select = this.dateSelect;
  3334. this.onChange = (/**
  3335. * @param {?} _
  3336. * @return {?}
  3337. */
  3338. function (_) { });
  3339. this.onTouched = (/**
  3340. * @return {?}
  3341. */
  3342. function () { });
  3343. ['dayTemplate', 'dayTemplateData', 'displayMonths', 'firstDayOfWeek', 'footerTemplate', 'markDisabled', 'minDate',
  3344. 'maxDate', 'navigation', 'outsideDays', 'showWeekdays', 'showWeekNumbers', 'startDate']
  3345. .forEach((/**
  3346. * @param {?} input
  3347. * @return {?}
  3348. */
  3349. function (input) { return _this[input] = config[input]; }));
  3350. _service.dateSelect$.pipe(operators.takeUntil(this._destroyed$)).subscribe((/**
  3351. * @param {?} date
  3352. * @return {?}
  3353. */
  3354. function (date) { _this.dateSelect.emit(date); }));
  3355. _service.model$.pipe(operators.takeUntil(this._destroyed$)).subscribe((/**
  3356. * @param {?} model
  3357. * @return {?}
  3358. */
  3359. function (model) {
  3360. /** @type {?} */
  3361. var newDate = model.firstDate;
  3362. /** @type {?} */
  3363. var oldDate = _this.model ? _this.model.firstDate : null;
  3364. // update public state
  3365. _this._publicState = {
  3366. maxDate: model.maxDate,
  3367. minDate: model.minDate,
  3368. firstDate: model.firstDate,
  3369. lastDate: model.lastDate,
  3370. focusedDate: model.focusDate
  3371. };
  3372. /** @type {?} */
  3373. var navigationPrevented = false;
  3374. // emitting navigation event if the first month changes
  3375. if (!newDate.equals(oldDate)) {
  3376. _this.navigate.emit({
  3377. current: oldDate ? { year: oldDate.year, month: oldDate.month } : null,
  3378. next: { year: newDate.year, month: newDate.month },
  3379. preventDefault: (/**
  3380. * @return {?}
  3381. */
  3382. function () { return navigationPrevented = true; })
  3383. });
  3384. // can't prevent the very first navigation
  3385. if (navigationPrevented && oldDate !== null) {
  3386. _this._service.open(oldDate);
  3387. return;
  3388. }
  3389. }
  3390. /** @type {?} */
  3391. var newSelectedDate = model.selectedDate;
  3392. /** @type {?} */
  3393. var newFocusedDate = model.focusDate;
  3394. /** @type {?} */
  3395. var oldFocusedDate = _this.model ? _this.model.focusDate : null;
  3396. _this.model = model;
  3397. // handling selection change
  3398. if (isChangedDate(newSelectedDate, _this._controlValue)) {
  3399. _this._controlValue = newSelectedDate;
  3400. _this.onTouched();
  3401. _this.onChange(_this._ngbDateAdapter.toModel(newSelectedDate));
  3402. }
  3403. // handling focus change
  3404. if (isChangedDate(newFocusedDate, oldFocusedDate) && oldFocusedDate && model.focusVisible) {
  3405. _this.focus();
  3406. }
  3407. cd.markForCheck();
  3408. }));
  3409. }
  3410. Object.defineProperty(NgbDatepicker.prototype, "state", {
  3411. /**
  3412. * Returns the readonly public state of the datepicker
  3413. *
  3414. * @since 5.2.0
  3415. */
  3416. get: /**
  3417. * Returns the readonly public state of the datepicker
  3418. *
  3419. * \@since 5.2.0
  3420. * @return {?}
  3421. */
  3422. function () { return this._publicState; },
  3423. enumerable: true,
  3424. configurable: true
  3425. });
  3426. /**
  3427. * Focuses on given date.
  3428. */
  3429. /**
  3430. * Focuses on given date.
  3431. * @param {?} date
  3432. * @return {?}
  3433. */
  3434. NgbDatepicker.prototype.focusDate = /**
  3435. * Focuses on given date.
  3436. * @param {?} date
  3437. * @return {?}
  3438. */
  3439. function (date) { this._service.focus(NgbDate.from(date)); };
  3440. /**
  3441. * Selects focused date.
  3442. */
  3443. /**
  3444. * Selects focused date.
  3445. * @return {?}
  3446. */
  3447. NgbDatepicker.prototype.focusSelect = /**
  3448. * Selects focused date.
  3449. * @return {?}
  3450. */
  3451. function () { this._service.focusSelect(); };
  3452. /**
  3453. * @return {?}
  3454. */
  3455. NgbDatepicker.prototype.focus = /**
  3456. * @return {?}
  3457. */
  3458. function () {
  3459. var _this = this;
  3460. this._ngZone.onStable.asObservable().pipe(operators.take(1)).subscribe((/**
  3461. * @return {?}
  3462. */
  3463. function () {
  3464. /** @type {?} */
  3465. var elementToFocus = _this._elementRef.nativeElement.querySelector('div.ngb-dp-day[tabindex="0"]');
  3466. if (elementToFocus) {
  3467. elementToFocus.focus();
  3468. }
  3469. }));
  3470. };
  3471. /**
  3472. * Navigates to the provided date.
  3473. *
  3474. * With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.
  3475. * If nothing or invalid date provided calendar will open current month.
  3476. *
  3477. * Use the `[startDate]` input as an alternative.
  3478. */
  3479. /**
  3480. * Navigates to the provided date.
  3481. *
  3482. * With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.
  3483. * If nothing or invalid date provided calendar will open current month.
  3484. *
  3485. * Use the `[startDate]` input as an alternative.
  3486. * @param {?=} date
  3487. * @return {?}
  3488. */
  3489. NgbDatepicker.prototype.navigateTo = /**
  3490. * Navigates to the provided date.
  3491. *
  3492. * With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.
  3493. * If nothing or invalid date provided calendar will open current month.
  3494. *
  3495. * Use the `[startDate]` input as an alternative.
  3496. * @param {?=} date
  3497. * @return {?}
  3498. */
  3499. function (date) {
  3500. this._service.open(NgbDate.from(date ? date.day ? (/** @type {?} */ (date)) : __assign({}, date, { day: 1 }) : null));
  3501. };
  3502. /**
  3503. * @return {?}
  3504. */
  3505. NgbDatepicker.prototype.ngAfterViewInit = /**
  3506. * @return {?}
  3507. */
  3508. function () {
  3509. var _this = this;
  3510. this._ngZone.runOutsideAngular((/**
  3511. * @return {?}
  3512. */
  3513. function () {
  3514. /** @type {?} */
  3515. var focusIns$ = rxjs.fromEvent(_this._monthsEl.nativeElement, 'focusin');
  3516. /** @type {?} */
  3517. var focusOuts$ = rxjs.fromEvent(_this._monthsEl.nativeElement, 'focusout');
  3518. var nativeElement = _this._elementRef.nativeElement;
  3519. // we're changing 'focusVisible' only when entering or leaving months view
  3520. // and ignoring all focus events where both 'target' and 'related' target are day cells
  3521. rxjs.merge(focusIns$, focusOuts$)
  3522. .pipe(operators.filter((/**
  3523. * @param {?} __0
  3524. * @return {?}
  3525. */
  3526. function (_a) {
  3527. var target = _a.target, relatedTarget = _a.relatedTarget;
  3528. return !(hasClassName(target, 'ngb-dp-day') && hasClassName(relatedTarget, 'ngb-dp-day') &&
  3529. nativeElement.contains((/** @type {?} */ (target))) && nativeElement.contains((/** @type {?} */ (relatedTarget))));
  3530. })), operators.takeUntil(_this._destroyed$))
  3531. .subscribe((/**
  3532. * @param {?} __0
  3533. * @return {?}
  3534. */
  3535. function (_a) {
  3536. var type = _a.type;
  3537. return _this._ngZone.run((/**
  3538. * @return {?}
  3539. */
  3540. function () { return _this._service.set({ focusVisible: type === 'focusin' }); }));
  3541. }));
  3542. }));
  3543. };
  3544. /**
  3545. * @return {?}
  3546. */
  3547. NgbDatepicker.prototype.ngOnDestroy = /**
  3548. * @return {?}
  3549. */
  3550. function () { this._destroyed$.next(); };
  3551. /**
  3552. * @return {?}
  3553. */
  3554. NgbDatepicker.prototype.ngOnInit = /**
  3555. * @return {?}
  3556. */
  3557. function () {
  3558. var _this = this;
  3559. if (this.model === undefined) {
  3560. /** @type {?} */
  3561. var inputs_1 = {};
  3562. ['dayTemplateData', 'displayMonths', 'markDisabled', 'firstDayOfWeek', 'navigation', 'minDate', 'maxDate',
  3563. 'outsideDays']
  3564. .forEach((/**
  3565. * @param {?} name
  3566. * @return {?}
  3567. */
  3568. function (name) { return inputs_1[name] = _this[name]; }));
  3569. this._service.set(inputs_1);
  3570. this.navigateTo(this.startDate);
  3571. }
  3572. };
  3573. /**
  3574. * @param {?} changes
  3575. * @return {?}
  3576. */
  3577. NgbDatepicker.prototype.ngOnChanges = /**
  3578. * @param {?} changes
  3579. * @return {?}
  3580. */
  3581. function (changes) {
  3582. var _this = this;
  3583. /** @type {?} */
  3584. var inputs = {};
  3585. ['dayTemplateData', 'displayMonths', 'markDisabled', 'firstDayOfWeek', 'navigation', 'minDate', 'maxDate',
  3586. 'outsideDays']
  3587. .filter((/**
  3588. * @param {?} name
  3589. * @return {?}
  3590. */
  3591. function (name) { return name in changes; }))
  3592. .forEach((/**
  3593. * @param {?} name
  3594. * @return {?}
  3595. */
  3596. function (name) { return inputs[name] = _this[name]; }));
  3597. this._service.set(inputs);
  3598. if ('startDate' in changes) {
  3599. var _a = changes.startDate, currentValue = _a.currentValue, previousValue = _a.previousValue;
  3600. if (isChangedMonth(previousValue, currentValue)) {
  3601. this.navigateTo(this.startDate);
  3602. }
  3603. }
  3604. };
  3605. /**
  3606. * @param {?} date
  3607. * @return {?}
  3608. */
  3609. NgbDatepicker.prototype.onDateSelect = /**
  3610. * @param {?} date
  3611. * @return {?}
  3612. */
  3613. function (date) {
  3614. this._service.focus(date);
  3615. this._service.select(date, { emitEvent: true });
  3616. };
  3617. /**
  3618. * @param {?} event
  3619. * @return {?}
  3620. */
  3621. NgbDatepicker.prototype.onKeyDown = /**
  3622. * @param {?} event
  3623. * @return {?}
  3624. */
  3625. function (event) { this._keyboardService.processKey(event, this, this._calendar); };
  3626. /**
  3627. * @param {?} date
  3628. * @return {?}
  3629. */
  3630. NgbDatepicker.prototype.onNavigateDateSelect = /**
  3631. * @param {?} date
  3632. * @return {?}
  3633. */
  3634. function (date) { this._service.open(date); };
  3635. /**
  3636. * @param {?} event
  3637. * @return {?}
  3638. */
  3639. NgbDatepicker.prototype.onNavigateEvent = /**
  3640. * @param {?} event
  3641. * @return {?}
  3642. */
  3643. function (event) {
  3644. switch (event) {
  3645. case NavigationEvent.PREV:
  3646. this._service.open(this._calendar.getPrev(this.model.firstDate, 'm', 1));
  3647. break;
  3648. case NavigationEvent.NEXT:
  3649. this._service.open(this._calendar.getNext(this.model.firstDate, 'm', 1));
  3650. break;
  3651. }
  3652. };
  3653. /**
  3654. * @param {?} fn
  3655. * @return {?}
  3656. */
  3657. NgbDatepicker.prototype.registerOnChange = /**
  3658. * @param {?} fn
  3659. * @return {?}
  3660. */
  3661. function (fn) { this.onChange = fn; };
  3662. /**
  3663. * @param {?} fn
  3664. * @return {?}
  3665. */
  3666. NgbDatepicker.prototype.registerOnTouched = /**
  3667. * @param {?} fn
  3668. * @return {?}
  3669. */
  3670. function (fn) { this.onTouched = fn; };
  3671. /**
  3672. * @param {?} disabled
  3673. * @return {?}
  3674. */
  3675. NgbDatepicker.prototype.setDisabledState = /**
  3676. * @param {?} disabled
  3677. * @return {?}
  3678. */
  3679. function (disabled) { this._service.set({ disabled: disabled }); };
  3680. /**
  3681. * @param {?} value
  3682. * @return {?}
  3683. */
  3684. NgbDatepicker.prototype.writeValue = /**
  3685. * @param {?} value
  3686. * @return {?}
  3687. */
  3688. function (value) {
  3689. this._controlValue = NgbDate.from(this._ngbDateAdapter.fromModel(value));
  3690. this._service.select(this._controlValue);
  3691. };
  3692. NgbDatepicker.decorators = [
  3693. { type: core.Component, args: [{
  3694. exportAs: 'ngbDatepicker',
  3695. selector: 'ngb-datepicker',
  3696. changeDetection: core.ChangeDetectionStrategy.OnPush,
  3697. encapsulation: core.ViewEncapsulation.None,
  3698. template: "\n <ng-template #dt let-date=\"date\" let-currentMonth=\"currentMonth\" let-selected=\"selected\" let-disabled=\"disabled\" let-focused=\"focused\">\n <div ngbDatepickerDayView\n [date]=\"date\"\n [currentMonth]=\"currentMonth\"\n [selected]=\"selected\"\n [disabled]=\"disabled\"\n [focused]=\"focused\">\n </div>\n </ng-template>\n\n <div class=\"ngb-dp-header\">\n <ngb-datepicker-navigation *ngIf=\"navigation !== 'none'\"\n [date]=\"model.firstDate\"\n [months]=\"model.months\"\n [disabled]=\"model.disabled\"\n [showSelect]=\"model.navigation === 'select'\"\n [prevDisabled]=\"model.prevDisabled\"\n [nextDisabled]=\"model.nextDisabled\"\n [selectBoxes]=\"model.selectBoxes\"\n (navigate)=\"onNavigateEvent($event)\"\n (select)=\"onNavigateDateSelect($event)\">\n </ngb-datepicker-navigation>\n </div>\n\n <div #months class=\"ngb-dp-months\" (keydown)=\"onKeyDown($event)\">\n <ng-template ngFor let-month [ngForOf]=\"model.months\" let-i=\"index\">\n <div class=\"ngb-dp-month\">\n <div *ngIf=\"navigation === 'none' || (displayMonths > 1 && navigation === 'select')\"\n class=\"ngb-dp-month-name\">\n {{ i18n.getMonthFullName(month.number, month.year) }} {{ i18n.getYearNumerals(month.year) }}\n </div>\n <ngb-datepicker-month-view\n [month]=\"month\"\n [dayTemplate]=\"dayTemplate || dt\"\n [showWeekdays]=\"showWeekdays\"\n [showWeekNumbers]=\"showWeekNumbers\"\n (select)=\"onDateSelect($event)\">\n </ngb-datepicker-month-view>\n </div>\n </ng-template>\n </div>\n\n <ng-template [ngTemplateOutlet]=\"footerTemplate\"></ng-template>\n ",
  3699. providers: [NGB_DATEPICKER_VALUE_ACCESSOR, NgbDatepickerService],
  3700. styles: ["ngb-datepicker{border:1px solid #dfdfdf;border-radius:.25rem;display:inline-block}ngb-datepicker-month-view{pointer-events:auto}ngb-datepicker.dropdown-menu{padding:0}.ngb-dp-body{z-index:1050}.ngb-dp-header{border-bottom:0;border-radius:.25rem .25rem 0 0;padding-top:.25rem;background-color:#f8f9fa;background-color:var(--light)}.ngb-dp-months{display:-ms-flexbox;display:flex}.ngb-dp-month{pointer-events:none}.ngb-dp-month-name{font-size:larger;height:2rem;line-height:2rem;text-align:center;background-color:#f8f9fa;background-color:var(--light)}.ngb-dp-month+.ngb-dp-month .ngb-dp-month-name,.ngb-dp-month+.ngb-dp-month .ngb-dp-week{padding-left:1rem}.ngb-dp-month:last-child .ngb-dp-week{padding-right:.25rem}.ngb-dp-month:first-child .ngb-dp-week{padding-left:.25rem}.ngb-dp-month .ngb-dp-week:last-child{padding-bottom:.25rem}"]
  3701. }] }
  3702. ];
  3703. /** @nocollapse */
  3704. NgbDatepicker.ctorParameters = function () { return [
  3705. { type: NgbDatepickerService },
  3706. { type: NgbCalendar },
  3707. { type: NgbDatepickerI18n },
  3708. { type: NgbDatepickerConfig },
  3709. { type: NgbDatepickerKeyboardService },
  3710. { type: core.ChangeDetectorRef },
  3711. { type: core.ElementRef },
  3712. { type: NgbDateAdapter },
  3713. { type: core.NgZone }
  3714. ]; };
  3715. NgbDatepicker.propDecorators = {
  3716. _monthsEl: [{ type: core.ViewChild, args: ['months', { static: true },] }],
  3717. dayTemplate: [{ type: core.Input }],
  3718. dayTemplateData: [{ type: core.Input }],
  3719. displayMonths: [{ type: core.Input }],
  3720. firstDayOfWeek: [{ type: core.Input }],
  3721. footerTemplate: [{ type: core.Input }],
  3722. markDisabled: [{ type: core.Input }],
  3723. maxDate: [{ type: core.Input }],
  3724. minDate: [{ type: core.Input }],
  3725. navigation: [{ type: core.Input }],
  3726. outsideDays: [{ type: core.Input }],
  3727. showWeekdays: [{ type: core.Input }],
  3728. showWeekNumbers: [{ type: core.Input }],
  3729. startDate: [{ type: core.Input }],
  3730. navigate: [{ type: core.Output }],
  3731. dateSelect: [{ type: core.Output }],
  3732. select: [{ type: core.Output }]
  3733. };
  3734. return NgbDatepicker;
  3735. }());
  3736. /**
  3737. * @fileoverview added by tsickle
  3738. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3739. */
  3740. var NgbDatepickerMonthView = /** @class */ (function () {
  3741. function NgbDatepickerMonthView(i18n) {
  3742. this.i18n = i18n;
  3743. this.select = new core.EventEmitter();
  3744. }
  3745. /**
  3746. * @param {?} day
  3747. * @return {?}
  3748. */
  3749. NgbDatepickerMonthView.prototype.doSelect = /**
  3750. * @param {?} day
  3751. * @return {?}
  3752. */
  3753. function (day) {
  3754. if (!day.context.disabled && !day.hidden) {
  3755. this.select.emit(day.date);
  3756. }
  3757. };
  3758. NgbDatepickerMonthView.decorators = [
  3759. { type: core.Component, args: [{
  3760. selector: 'ngb-datepicker-month-view',
  3761. host: { 'role': 'grid' },
  3762. encapsulation: core.ViewEncapsulation.None,
  3763. template: "\n <div *ngIf=\"showWeekdays\" class=\"ngb-dp-week ngb-dp-weekdays\" role=\"row\">\n <div *ngIf=\"showWeekNumbers\" class=\"ngb-dp-weekday ngb-dp-showweek\"></div>\n <div *ngFor=\"let w of month.weekdays\" class=\"ngb-dp-weekday small\" role=\"columnheader\">\n {{ i18n.getWeekdayShortName(w) }}\n </div>\n </div>\n <ng-template ngFor let-week [ngForOf]=\"month.weeks\">\n <div *ngIf=\"!week.collapsed\" class=\"ngb-dp-week\" role=\"row\">\n <div *ngIf=\"showWeekNumbers\" class=\"ngb-dp-week-number small text-muted\">{{ i18n.getWeekNumerals(week.number) }}</div>\n <div *ngFor=\"let day of week.days\" (click)=\"doSelect(day); $event.preventDefault()\" class=\"ngb-dp-day\" role=\"gridcell\"\n [class.disabled]=\"day.context.disabled\"\n [tabindex]=\"day.tabindex\"\n [class.hidden]=\"day.hidden\"\n [class.ngb-dp-today]=\"day.context.today\"\n [attr.aria-label]=\"day.ariaLabel\">\n <ng-template [ngIf]=\"!day.hidden\">\n <ng-template [ngTemplateOutlet]=\"dayTemplate\" [ngTemplateOutletContext]=\"day.context\"></ng-template>\n </ng-template>\n </div>\n </div>\n </ng-template>\n ",
  3764. styles: ["ngb-datepicker-month-view{display:block}.ngb-dp-week-number,.ngb-dp-weekday{line-height:2rem;text-align:center;font-style:italic}.ngb-dp-weekday{color:#5bc0de;color:var(--info)}.ngb-dp-week{border-radius:.25rem;display:-ms-flexbox;display:flex}.ngb-dp-weekdays{border-bottom:1px solid rgba(0,0,0,.125);border-radius:0;background-color:#f8f9fa;background-color:var(--light)}.ngb-dp-day,.ngb-dp-week-number,.ngb-dp-weekday{width:2rem;height:2rem}.ngb-dp-day{cursor:pointer}.ngb-dp-day.disabled,.ngb-dp-day.hidden{cursor:default}.ngb-dp-day[tabindex=\"0\"]{z-index:1}"]
  3765. }] }
  3766. ];
  3767. /** @nocollapse */
  3768. NgbDatepickerMonthView.ctorParameters = function () { return [
  3769. { type: NgbDatepickerI18n }
  3770. ]; };
  3771. NgbDatepickerMonthView.propDecorators = {
  3772. dayTemplate: [{ type: core.Input }],
  3773. month: [{ type: core.Input }],
  3774. showWeekdays: [{ type: core.Input }],
  3775. showWeekNumbers: [{ type: core.Input }],
  3776. select: [{ type: core.Output }]
  3777. };
  3778. return NgbDatepickerMonthView;
  3779. }());
  3780. /**
  3781. * @fileoverview added by tsickle
  3782. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3783. */
  3784. var NgbDatepickerNavigation = /** @class */ (function () {
  3785. function NgbDatepickerNavigation(i18n) {
  3786. this.i18n = i18n;
  3787. this.navigation = NavigationEvent;
  3788. this.months = [];
  3789. this.navigate = new core.EventEmitter();
  3790. this.select = new core.EventEmitter();
  3791. }
  3792. /**
  3793. * @param {?} event
  3794. * @return {?}
  3795. */
  3796. NgbDatepickerNavigation.prototype.onClickPrev = /**
  3797. * @param {?} event
  3798. * @return {?}
  3799. */
  3800. function (event) {
  3801. ((/** @type {?} */ (event.currentTarget))).focus();
  3802. this.navigate.emit(this.navigation.PREV);
  3803. };
  3804. /**
  3805. * @param {?} event
  3806. * @return {?}
  3807. */
  3808. NgbDatepickerNavigation.prototype.onClickNext = /**
  3809. * @param {?} event
  3810. * @return {?}
  3811. */
  3812. function (event) {
  3813. ((/** @type {?} */ (event.currentTarget))).focus();
  3814. this.navigate.emit(this.navigation.NEXT);
  3815. };
  3816. NgbDatepickerNavigation.decorators = [
  3817. { type: core.Component, args: [{
  3818. selector: 'ngb-datepicker-navigation',
  3819. changeDetection: core.ChangeDetectionStrategy.OnPush,
  3820. encapsulation: core.ViewEncapsulation.None,
  3821. template: "\n <div class=\"ngb-dp-arrow\">\n <button type=\"button\" class=\"btn btn-link ngb-dp-arrow-btn\" (click)=\"onClickPrev($event)\" [disabled]=\"prevDisabled\"\n i18n-aria-label=\"@@ngb.datepicker.previous-month\" aria-label=\"Previous month\"\n i18n-title=\"@@ngb.datepicker.previous-month\" title=\"Previous month\">\n <span class=\"ngb-dp-navigation-chevron\"></span>\n </button>\n </div>\n <ngb-datepicker-navigation-select *ngIf=\"showSelect\" class=\"ngb-dp-navigation-select\"\n [date]=\"date\"\n [disabled] = \"disabled\"\n [months]=\"selectBoxes.months\"\n [years]=\"selectBoxes.years\"\n (select)=\"select.emit($event)\">\n </ngb-datepicker-navigation-select>\n\n <ng-template *ngIf=\"!showSelect\" ngFor let-month [ngForOf]=\"months\" let-i=\"index\">\n <div class=\"ngb-dp-arrow\" *ngIf=\"i > 0\"></div>\n <div class=\"ngb-dp-month-name\">\n {{ i18n.getMonthFullName(month.number, month.year) }} {{ i18n.getYearNumerals(month.year) }}\n </div>\n <div class=\"ngb-dp-arrow\" *ngIf=\"i !== months.length - 1\"></div>\n </ng-template>\n <div class=\"ngb-dp-arrow right\">\n <button type=\"button\" class=\"btn btn-link ngb-dp-arrow-btn\" (click)=\"onClickNext($event)\" [disabled]=\"nextDisabled\"\n i18n-aria-label=\"@@ngb.datepicker.next-month\" aria-label=\"Next month\"\n i18n-title=\"@@ngb.datepicker.next-month\" title=\"Next month\">\n <span class=\"ngb-dp-navigation-chevron\"></span>\n </button>\n </div>\n ",
  3822. styles: ["ngb-datepicker-navigation{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.ngb-dp-navigation-chevron{border-style:solid;border-width:.2em .2em 0 0;display:inline-block;width:.75em;height:.75em;margin-left:.25em;margin-right:.15em;-webkit-transform:rotate(-135deg);transform:rotate(-135deg)}.right .ngb-dp-navigation-chevron{-webkit-transform:rotate(45deg);transform:rotate(45deg);margin-left:.15em;margin-right:.25em}.ngb-dp-arrow{display:-ms-flexbox;display:flex;-ms-flex:1 1 auto;flex:1 1 auto;padding-right:0;padding-left:0;margin:0;width:2rem;height:2rem}.ngb-dp-arrow.right{-ms-flex-pack:end;justify-content:flex-end}.ngb-dp-arrow-btn{padding:0 .25rem;margin:0 .5rem;border:none;background-color:transparent;z-index:1}.ngb-dp-arrow-btn:focus{outline-width:1px;outline-style:auto}@media all and (-ms-high-contrast:none),(-ms-high-contrast:active){.ngb-dp-arrow-btn:focus{outline-style:solid}}.ngb-dp-month-name{font-size:larger;height:2rem;line-height:2rem;text-align:center}.ngb-dp-navigation-select{display:-ms-flexbox;display:flex;-ms-flex:1 1 9rem;flex:1 1 9rem}"]
  3823. }] }
  3824. ];
  3825. /** @nocollapse */
  3826. NgbDatepickerNavigation.ctorParameters = function () { return [
  3827. { type: NgbDatepickerI18n }
  3828. ]; };
  3829. NgbDatepickerNavigation.propDecorators = {
  3830. date: [{ type: core.Input }],
  3831. disabled: [{ type: core.Input }],
  3832. months: [{ type: core.Input }],
  3833. showSelect: [{ type: core.Input }],
  3834. prevDisabled: [{ type: core.Input }],
  3835. nextDisabled: [{ type: core.Input }],
  3836. selectBoxes: [{ type: core.Input }],
  3837. navigate: [{ type: core.Output }],
  3838. select: [{ type: core.Output }]
  3839. };
  3840. return NgbDatepickerNavigation;
  3841. }());
  3842. /**
  3843. * @fileoverview added by tsickle
  3844. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3845. */
  3846. /** @type {?} */
  3847. var isContainedIn = (/**
  3848. * @param {?} element
  3849. * @param {?=} array
  3850. * @return {?}
  3851. */
  3852. function (element, array) {
  3853. return array ? array.some((/**
  3854. * @param {?} item
  3855. * @return {?}
  3856. */
  3857. function (item) { return item.contains(element); })) : false;
  3858. });
  3859. /** @type {?} */
  3860. var matchesSelectorIfAny = (/**
  3861. * @param {?} element
  3862. * @param {?=} selector
  3863. * @return {?}
  3864. */
  3865. function (element, selector) {
  3866. return !selector || closest(element, selector) != null;
  3867. });
  3868. // we'll have to use 'touch' events instead of 'mouse' events on iOS and add a more significant delay
  3869. // to avoid re-opening when handling (click) on a toggling element
  3870. // TODO: use proper Angular platform detection when NgbAutoClose becomes a service and we can inject PLATFORM_ID
  3871. /** @type {?} */
  3872. var iOS = false;
  3873. if (typeof navigator !== 'undefined') {
  3874. iOS = !!navigator.userAgent && /iPad|iPhone|iPod/.test(navigator.userAgent);
  3875. }
  3876. // setting 'ngbAutoClose' synchronously on iOS results in immediate popup closing
  3877. // when tapping on the triggering element
  3878. /** @type {?} */
  3879. var wrapAsyncForiOS = (/**
  3880. * @param {?} fn
  3881. * @return {?}
  3882. */
  3883. function (fn) { return iOS ? (/**
  3884. * @return {?}
  3885. */
  3886. function () { return setTimeout((/**
  3887. * @return {?}
  3888. */
  3889. function () { return fn(); }), 100); }) : fn; });
  3890. /**
  3891. * @param {?} zone
  3892. * @param {?} document
  3893. * @param {?} type
  3894. * @param {?} close
  3895. * @param {?} closed$
  3896. * @param {?} insideElements
  3897. * @param {?=} ignoreElements
  3898. * @param {?=} insideSelector
  3899. * @return {?}
  3900. */
  3901. function ngbAutoClose(zone, document, type, close, closed$, insideElements, ignoreElements, insideSelector) {
  3902. // closing on ESC and outside clicks
  3903. if (type) {
  3904. zone.runOutsideAngular(wrapAsyncForiOS((/**
  3905. * @return {?}
  3906. */
  3907. function () {
  3908. /** @type {?} */
  3909. var shouldCloseOnClick = (/**
  3910. * @param {?} event
  3911. * @return {?}
  3912. */
  3913. function (event) {
  3914. /** @type {?} */
  3915. var element = (/** @type {?} */ (event.target));
  3916. if (event.button === 2 || isContainedIn(element, ignoreElements)) {
  3917. return false;
  3918. }
  3919. if (type === 'inside') {
  3920. return isContainedIn(element, insideElements) && matchesSelectorIfAny(element, insideSelector);
  3921. }
  3922. else if (type === 'outside') {
  3923. return !isContainedIn(element, insideElements);
  3924. }
  3925. else /* if (type === true) */ {
  3926. return matchesSelectorIfAny(element, insideSelector) || !isContainedIn(element, insideElements);
  3927. }
  3928. });
  3929. /** @type {?} */
  3930. var escapes$ = rxjs.fromEvent(document, 'keydown')
  3931. .pipe(operators.takeUntil(closed$),
  3932. // tslint:disable-next-line:deprecation
  3933. operators.filter((/**
  3934. * @param {?} e
  3935. * @return {?}
  3936. */
  3937. function (e) { return e.which === Key.Escape; })), operators.tap((/**
  3938. * @param {?} e
  3939. * @return {?}
  3940. */
  3941. function (e) { return e.preventDefault(); })));
  3942. // we have to pre-calculate 'shouldCloseOnClick' on 'mousedown/touchstart',
  3943. // because on 'mouseup/touchend' DOM nodes might be detached
  3944. /** @type {?} */
  3945. var mouseDowns$ = rxjs.fromEvent(document, 'mousedown').pipe(operators.map(shouldCloseOnClick), operators.takeUntil(closed$));
  3946. /** @type {?} */
  3947. var closeableClicks$ = (/** @type {?} */ (rxjs.fromEvent(document, 'mouseup')
  3948. .pipe(operators.withLatestFrom(mouseDowns$), operators.filter((/**
  3949. * @param {?} __0
  3950. * @return {?}
  3951. */
  3952. function (_a) {
  3953. var _b = __read(_a, 2), _ = _b[0], shouldClose = _b[1];
  3954. return shouldClose;
  3955. })), operators.delay(0), operators.takeUntil(closed$))));
  3956. rxjs.race([escapes$, closeableClicks$]).subscribe((/**
  3957. * @return {?}
  3958. */
  3959. function () { return zone.run(close); }));
  3960. })));
  3961. }
  3962. }
  3963. /**
  3964. * @fileoverview added by tsickle
  3965. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  3966. */
  3967. /** @type {?} */
  3968. var FOCUSABLE_ELEMENTS_SELECTOR = [
  3969. 'a[href]', 'button:not([disabled])', 'input:not([disabled]):not([type="hidden"])', 'select:not([disabled])',
  3970. 'textarea:not([disabled])', '[contenteditable]', '[tabindex]:not([tabindex="-1"])'
  3971. ].join(', ');
  3972. /**
  3973. * Returns first and last focusable elements inside of a given element based on specific CSS selector
  3974. * @param {?} element
  3975. * @return {?}
  3976. */
  3977. function getFocusableBoundaryElements(element) {
  3978. /** @type {?} */
  3979. var list = Array.from((/** @type {?} */ (element.querySelectorAll(FOCUSABLE_ELEMENTS_SELECTOR))))
  3980. .filter((/**
  3981. * @param {?} el
  3982. * @return {?}
  3983. */
  3984. function (el) { return el.tabIndex !== -1; }));
  3985. return [list[0], list[list.length - 1]];
  3986. }
  3987. /**
  3988. * Function that enforces browser focus to be trapped inside a DOM element.
  3989. *
  3990. * Works only for clicks inside the element and navigation with 'Tab', ignoring clicks outside of the element
  3991. *
  3992. * \@param zone Angular zone
  3993. * \@param element The element around which focus will be trapped inside
  3994. * \@param stopFocusTrap$ The observable stream. When completed the focus trap will clean up listeners
  3995. * and free internal resources
  3996. * \@param refocusOnClick Put the focus back to the last focused element whenever a click occurs on element (default to
  3997. * false)
  3998. * @type {?}
  3999. */
  4000. var ngbFocusTrap = (/**
  4001. * @param {?} zone
  4002. * @param {?} element
  4003. * @param {?} stopFocusTrap$
  4004. * @param {?=} refocusOnClick
  4005. * @return {?}
  4006. */
  4007. function (zone, element, stopFocusTrap$, refocusOnClick) {
  4008. if (refocusOnClick === void 0) { refocusOnClick = false; }
  4009. zone.runOutsideAngular((/**
  4010. * @return {?}
  4011. */
  4012. function () {
  4013. // last focused element
  4014. /** @type {?} */
  4015. var lastFocusedElement$ = rxjs.fromEvent(element, 'focusin').pipe(operators.takeUntil(stopFocusTrap$), operators.map((/**
  4016. * @param {?} e
  4017. * @return {?}
  4018. */
  4019. function (e) { return e.target; })));
  4020. // 'tab' / 'shift+tab' stream
  4021. rxjs.fromEvent(element, 'keydown')
  4022. .pipe(operators.takeUntil(stopFocusTrap$),
  4023. // tslint:disable:deprecation
  4024. operators.filter((/**
  4025. * @param {?} e
  4026. * @return {?}
  4027. */
  4028. function (e) { return e.which === Key.Tab; })),
  4029. // tslint:enable:deprecation
  4030. operators.withLatestFrom(lastFocusedElement$))
  4031. .subscribe((/**
  4032. * @param {?} __0
  4033. * @return {?}
  4034. */
  4035. function (_a) {
  4036. var _b = __read(_a, 2), tabEvent = _b[0], focusedElement = _b[1];
  4037. var _c = __read(getFocusableBoundaryElements(element), 2), first = _c[0], last = _c[1];
  4038. if ((focusedElement === first || focusedElement === element) && tabEvent.shiftKey) {
  4039. last.focus();
  4040. tabEvent.preventDefault();
  4041. }
  4042. if (focusedElement === last && !tabEvent.shiftKey) {
  4043. first.focus();
  4044. tabEvent.preventDefault();
  4045. }
  4046. }));
  4047. // inside click
  4048. if (refocusOnClick) {
  4049. rxjs.fromEvent(element, 'click')
  4050. .pipe(operators.takeUntil(stopFocusTrap$), operators.withLatestFrom(lastFocusedElement$), operators.map((/**
  4051. * @param {?} arr
  4052. * @return {?}
  4053. */
  4054. function (arr) { return (/** @type {?} */ (arr[1])); })))
  4055. .subscribe((/**
  4056. * @param {?} lastFocusedElement
  4057. * @return {?}
  4058. */
  4059. function (lastFocusedElement) { return lastFocusedElement.focus(); }));
  4060. }
  4061. }));
  4062. });
  4063. /**
  4064. * @fileoverview added by tsickle
  4065. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4066. */
  4067. // previous version:
  4068. // https://github.com/angular-ui/bootstrap/blob/07c31d0731f7cb068a1932b8e01d2312b796b4ec/src/position/position.js
  4069. var
  4070. // previous version:
  4071. // https://github.com/angular-ui/bootstrap/blob/07c31d0731f7cb068a1932b8e01d2312b796b4ec/src/position/position.js
  4072. Positioning = /** @class */ (function () {
  4073. function Positioning() {
  4074. }
  4075. /**
  4076. * @private
  4077. * @param {?} element
  4078. * @return {?}
  4079. */
  4080. Positioning.prototype.getAllStyles = /**
  4081. * @private
  4082. * @param {?} element
  4083. * @return {?}
  4084. */
  4085. function (element) { return window.getComputedStyle(element); };
  4086. /**
  4087. * @private
  4088. * @param {?} element
  4089. * @param {?} prop
  4090. * @return {?}
  4091. */
  4092. Positioning.prototype.getStyle = /**
  4093. * @private
  4094. * @param {?} element
  4095. * @param {?} prop
  4096. * @return {?}
  4097. */
  4098. function (element, prop) { return this.getAllStyles(element)[prop]; };
  4099. /**
  4100. * @private
  4101. * @param {?} element
  4102. * @return {?}
  4103. */
  4104. Positioning.prototype.isStaticPositioned = /**
  4105. * @private
  4106. * @param {?} element
  4107. * @return {?}
  4108. */
  4109. function (element) {
  4110. return (this.getStyle(element, 'position') || 'static') === 'static';
  4111. };
  4112. /**
  4113. * @private
  4114. * @param {?} element
  4115. * @return {?}
  4116. */
  4117. Positioning.prototype.offsetParent = /**
  4118. * @private
  4119. * @param {?} element
  4120. * @return {?}
  4121. */
  4122. function (element) {
  4123. /** @type {?} */
  4124. var offsetParentEl = (/** @type {?} */ (element.offsetParent)) || document.documentElement;
  4125. while (offsetParentEl && offsetParentEl !== document.documentElement && this.isStaticPositioned(offsetParentEl)) {
  4126. offsetParentEl = (/** @type {?} */ (offsetParentEl.offsetParent));
  4127. }
  4128. return offsetParentEl || document.documentElement;
  4129. };
  4130. /**
  4131. * @param {?} element
  4132. * @param {?=} round
  4133. * @return {?}
  4134. */
  4135. Positioning.prototype.position = /**
  4136. * @param {?} element
  4137. * @param {?=} round
  4138. * @return {?}
  4139. */
  4140. function (element, round) {
  4141. if (round === void 0) { round = true; }
  4142. /** @type {?} */
  4143. var elPosition;
  4144. /** @type {?} */
  4145. var parentOffset = { width: 0, height: 0, top: 0, bottom: 0, left: 0, right: 0 };
  4146. if (this.getStyle(element, 'position') === 'fixed') {
  4147. elPosition = element.getBoundingClientRect();
  4148. elPosition = {
  4149. top: elPosition.top,
  4150. bottom: elPosition.bottom,
  4151. left: elPosition.left,
  4152. right: elPosition.right,
  4153. height: elPosition.height,
  4154. width: elPosition.width
  4155. };
  4156. }
  4157. else {
  4158. /** @type {?} */
  4159. var offsetParentEl = this.offsetParent(element);
  4160. elPosition = this.offset(element, false);
  4161. if (offsetParentEl !== document.documentElement) {
  4162. parentOffset = this.offset(offsetParentEl, false);
  4163. }
  4164. parentOffset.top += offsetParentEl.clientTop;
  4165. parentOffset.left += offsetParentEl.clientLeft;
  4166. }
  4167. elPosition.top -= parentOffset.top;
  4168. elPosition.bottom -= parentOffset.top;
  4169. elPosition.left -= parentOffset.left;
  4170. elPosition.right -= parentOffset.left;
  4171. if (round) {
  4172. elPosition.top = Math.round(elPosition.top);
  4173. elPosition.bottom = Math.round(elPosition.bottom);
  4174. elPosition.left = Math.round(elPosition.left);
  4175. elPosition.right = Math.round(elPosition.right);
  4176. }
  4177. return elPosition;
  4178. };
  4179. /**
  4180. * @param {?} element
  4181. * @param {?=} round
  4182. * @return {?}
  4183. */
  4184. Positioning.prototype.offset = /**
  4185. * @param {?} element
  4186. * @param {?=} round
  4187. * @return {?}
  4188. */
  4189. function (element, round) {
  4190. if (round === void 0) { round = true; }
  4191. /** @type {?} */
  4192. var elBcr = element.getBoundingClientRect();
  4193. /** @type {?} */
  4194. var viewportOffset = {
  4195. top: window.pageYOffset - document.documentElement.clientTop,
  4196. left: window.pageXOffset - document.documentElement.clientLeft
  4197. };
  4198. /** @type {?} */
  4199. var elOffset = {
  4200. height: elBcr.height || element.offsetHeight,
  4201. width: elBcr.width || element.offsetWidth,
  4202. top: elBcr.top + viewportOffset.top,
  4203. bottom: elBcr.bottom + viewportOffset.top,
  4204. left: elBcr.left + viewportOffset.left,
  4205. right: elBcr.right + viewportOffset.left
  4206. };
  4207. if (round) {
  4208. elOffset.height = Math.round(elOffset.height);
  4209. elOffset.width = Math.round(elOffset.width);
  4210. elOffset.top = Math.round(elOffset.top);
  4211. elOffset.bottom = Math.round(elOffset.bottom);
  4212. elOffset.left = Math.round(elOffset.left);
  4213. elOffset.right = Math.round(elOffset.right);
  4214. }
  4215. return elOffset;
  4216. };
  4217. /*
  4218. Return false if the element to position is outside the viewport
  4219. */
  4220. /*
  4221. Return false if the element to position is outside the viewport
  4222. */
  4223. /**
  4224. * @param {?} hostElement
  4225. * @param {?} targetElement
  4226. * @param {?} placement
  4227. * @param {?=} appendToBody
  4228. * @return {?}
  4229. */
  4230. Positioning.prototype.positionElements = /*
  4231. Return false if the element to position is outside the viewport
  4232. */
  4233. /**
  4234. * @param {?} hostElement
  4235. * @param {?} targetElement
  4236. * @param {?} placement
  4237. * @param {?=} appendToBody
  4238. * @return {?}
  4239. */
  4240. function (hostElement, targetElement, placement, appendToBody) {
  4241. var _a = __read(placement.split('-'), 2), _b = _a[0], placementPrimary = _b === void 0 ? 'top' : _b, _c = _a[1], placementSecondary = _c === void 0 ? 'center' : _c;
  4242. /** @type {?} */
  4243. var hostElPosition = appendToBody ? this.offset(hostElement, false) : this.position(hostElement, false);
  4244. /** @type {?} */
  4245. var targetElStyles = this.getAllStyles(targetElement);
  4246. /** @type {?} */
  4247. var marginTop = parseFloat(targetElStyles.marginTop);
  4248. /** @type {?} */
  4249. var marginBottom = parseFloat(targetElStyles.marginBottom);
  4250. /** @type {?} */
  4251. var marginLeft = parseFloat(targetElStyles.marginLeft);
  4252. /** @type {?} */
  4253. var marginRight = parseFloat(targetElStyles.marginRight);
  4254. /** @type {?} */
  4255. var topPosition = 0;
  4256. /** @type {?} */
  4257. var leftPosition = 0;
  4258. switch (placementPrimary) {
  4259. case 'top':
  4260. topPosition = (hostElPosition.top - (targetElement.offsetHeight + marginTop + marginBottom));
  4261. break;
  4262. case 'bottom':
  4263. topPosition = (hostElPosition.top + hostElPosition.height);
  4264. break;
  4265. case 'left':
  4266. leftPosition = (hostElPosition.left - (targetElement.offsetWidth + marginLeft + marginRight));
  4267. break;
  4268. case 'right':
  4269. leftPosition = (hostElPosition.left + hostElPosition.width);
  4270. break;
  4271. }
  4272. switch (placementSecondary) {
  4273. case 'top':
  4274. topPosition = hostElPosition.top;
  4275. break;
  4276. case 'bottom':
  4277. topPosition = hostElPosition.top + hostElPosition.height - targetElement.offsetHeight;
  4278. break;
  4279. case 'left':
  4280. leftPosition = hostElPosition.left;
  4281. break;
  4282. case 'right':
  4283. leftPosition = hostElPosition.left + hostElPosition.width - targetElement.offsetWidth;
  4284. break;
  4285. case 'center':
  4286. if (placementPrimary === 'top' || placementPrimary === 'bottom') {
  4287. leftPosition = (hostElPosition.left + hostElPosition.width / 2 - targetElement.offsetWidth / 2);
  4288. }
  4289. else {
  4290. topPosition = (hostElPosition.top + hostElPosition.height / 2 - targetElement.offsetHeight / 2);
  4291. }
  4292. break;
  4293. }
  4294. /// The translate3d/gpu acceleration render a blurry text on chrome, the next line is commented until a browser fix
  4295. // targetElement.style.transform = `translate3d(${Math.round(leftPosition)}px, ${Math.floor(topPosition)}px, 0px)`;
  4296. targetElement.style.transform = "translate(" + Math.round(leftPosition) + "px, " + Math.round(topPosition) + "px)";
  4297. // Check if the targetElement is inside the viewport
  4298. /** @type {?} */
  4299. var targetElBCR = targetElement.getBoundingClientRect();
  4300. /** @type {?} */
  4301. var html = document.documentElement;
  4302. /** @type {?} */
  4303. var windowHeight = window.innerHeight || html.clientHeight;
  4304. /** @type {?} */
  4305. var windowWidth = window.innerWidth || html.clientWidth;
  4306. return targetElBCR.left >= 0 && targetElBCR.top >= 0 && targetElBCR.right <= windowWidth &&
  4307. targetElBCR.bottom <= windowHeight;
  4308. };
  4309. return Positioning;
  4310. }());
  4311. /** @type {?} */
  4312. var placementSeparator = /\s+/;
  4313. /** @type {?} */
  4314. var positionService = new Positioning();
  4315. /*
  4316. * Accept the placement array and applies the appropriate placement dependent on the viewport.
  4317. * Returns the applied placement.
  4318. * In case of auto placement, placements are selected in order
  4319. * 'top', 'bottom', 'left', 'right',
  4320. * 'top-left', 'top-right',
  4321. * 'bottom-left', 'bottom-right',
  4322. * 'left-top', 'left-bottom',
  4323. * 'right-top', 'right-bottom'.
  4324. * */
  4325. /**
  4326. * @param {?} hostElement
  4327. * @param {?} targetElement
  4328. * @param {?} placement
  4329. * @param {?=} appendToBody
  4330. * @param {?=} baseClass
  4331. * @return {?}
  4332. */
  4333. function positionElements(hostElement, targetElement, placement, appendToBody, baseClass) {
  4334. var e_1, _a;
  4335. /** @type {?} */
  4336. var placementVals = Array.isArray(placement) ? placement : (/** @type {?} */ (placement.split(placementSeparator)));
  4337. /** @type {?} */
  4338. var allowedPlacements = [
  4339. 'top', 'bottom', 'left', 'right', 'top-left', 'top-right', 'bottom-left', 'bottom-right', 'left-top', 'left-bottom',
  4340. 'right-top', 'right-bottom'
  4341. ];
  4342. /** @type {?} */
  4343. var classList = targetElement.classList;
  4344. /** @type {?} */
  4345. var addClassesToTarget = (/**
  4346. * @param {?} targetPlacement
  4347. * @return {?}
  4348. */
  4349. function (targetPlacement) {
  4350. var _a = __read(targetPlacement.split('-'), 2), primary = _a[0], secondary = _a[1];
  4351. /** @type {?} */
  4352. var classes = [];
  4353. if (baseClass) {
  4354. classes.push(baseClass + "-" + primary);
  4355. if (secondary) {
  4356. classes.push(baseClass + "-" + primary + "-" + secondary);
  4357. }
  4358. classes.forEach((/**
  4359. * @param {?} classname
  4360. * @return {?}
  4361. */
  4362. function (classname) { classList.add(classname); }));
  4363. }
  4364. return classes;
  4365. });
  4366. // Remove old placement classes to avoid issues
  4367. if (baseClass) {
  4368. allowedPlacements.forEach((/**
  4369. * @param {?} placementToRemove
  4370. * @return {?}
  4371. */
  4372. function (placementToRemove) { classList.remove(baseClass + "-" + placementToRemove); }));
  4373. }
  4374. // replace auto placement with other placements
  4375. /** @type {?} */
  4376. var hasAuto = placementVals.findIndex((/**
  4377. * @param {?} val
  4378. * @return {?}
  4379. */
  4380. function (val) { return val === 'auto'; }));
  4381. if (hasAuto >= 0) {
  4382. allowedPlacements.forEach((/**
  4383. * @param {?} obj
  4384. * @return {?}
  4385. */
  4386. function (obj) {
  4387. if (placementVals.find((/**
  4388. * @param {?} val
  4389. * @return {?}
  4390. */
  4391. function (val) { return val.search('^' + obj) !== -1; })) == null) {
  4392. placementVals.splice(hasAuto++, 1, (/** @type {?} */ (obj)));
  4393. }
  4394. }));
  4395. }
  4396. // coordinates where to position
  4397. // Required for transform:
  4398. /** @type {?} */
  4399. var style = targetElement.style;
  4400. style.position = 'absolute';
  4401. style.top = '0';
  4402. style.left = '0';
  4403. style['will-change'] = 'transform';
  4404. /** @type {?} */
  4405. var testPlacement;
  4406. /** @type {?} */
  4407. var isInViewport = false;
  4408. try {
  4409. for (var placementVals_1 = __values(placementVals), placementVals_1_1 = placementVals_1.next(); !placementVals_1_1.done; placementVals_1_1 = placementVals_1.next()) {
  4410. testPlacement = placementVals_1_1.value;
  4411. /** @type {?} */
  4412. var addedClasses = addClassesToTarget(testPlacement);
  4413. if (positionService.positionElements(hostElement, targetElement, testPlacement, appendToBody)) {
  4414. isInViewport = true;
  4415. break;
  4416. }
  4417. // Remove the baseClasses for further calculation
  4418. if (baseClass) {
  4419. addedClasses.forEach((/**
  4420. * @param {?} classname
  4421. * @return {?}
  4422. */
  4423. function (classname) { classList.remove(classname); }));
  4424. }
  4425. }
  4426. }
  4427. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  4428. finally {
  4429. try {
  4430. if (placementVals_1_1 && !placementVals_1_1.done && (_a = placementVals_1.return)) _a.call(placementVals_1);
  4431. }
  4432. finally { if (e_1) throw e_1.error; }
  4433. }
  4434. if (!isInViewport) {
  4435. // If nothing match, the first placement is the default one
  4436. testPlacement = placementVals[0];
  4437. addClassesToTarget(testPlacement);
  4438. positionService.positionElements(hostElement, targetElement, testPlacement, appendToBody);
  4439. }
  4440. return testPlacement;
  4441. }
  4442. /**
  4443. * @fileoverview added by tsickle
  4444. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4445. */
  4446. /**
  4447. * @return {?}
  4448. */
  4449. function NGB_DATEPICKER_PARSER_FORMATTER_FACTORY() {
  4450. return new NgbDateISOParserFormatter();
  4451. }
  4452. /**
  4453. * An abstract service for parsing and formatting dates for the
  4454. * [`NgbInputDatepicker`](#/components/datepicker/api#NgbInputDatepicker) directive.
  4455. * Converts between the internal `NgbDateStruct` model presentation and a `string` that is displayed in the
  4456. * input element.
  4457. *
  4458. * When user types something in the input this service attempts to parse it into a `NgbDateStruct` object.
  4459. * And vice versa, when users selects a date in the calendar with the mouse, it must be displayed as a `string`
  4460. * in the input.
  4461. *
  4462. * Default implementation uses the ISO 8601 format, but you can provide another implementation via DI
  4463. * to use an alternative string format or a custom parsing logic.
  4464. *
  4465. * See the [date format overview](#/components/datepicker/overview#date-model) for more details.
  4466. * @abstract
  4467. */
  4468. var NgbDateParserFormatter = /** @class */ (function () {
  4469. function NgbDateParserFormatter() {
  4470. }
  4471. NgbDateParserFormatter.decorators = [
  4472. { type: core.Injectable, args: [{ providedIn: 'root', useFactory: NGB_DATEPICKER_PARSER_FORMATTER_FACTORY },] }
  4473. ];
  4474. /** @nocollapse */ NgbDateParserFormatter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: NGB_DATEPICKER_PARSER_FORMATTER_FACTORY, token: NgbDateParserFormatter, providedIn: "root" });
  4475. return NgbDateParserFormatter;
  4476. }());
  4477. var NgbDateISOParserFormatter = /** @class */ (function (_super) {
  4478. __extends(NgbDateISOParserFormatter, _super);
  4479. function NgbDateISOParserFormatter() {
  4480. return _super !== null && _super.apply(this, arguments) || this;
  4481. }
  4482. /**
  4483. * @param {?} value
  4484. * @return {?}
  4485. */
  4486. NgbDateISOParserFormatter.prototype.parse = /**
  4487. * @param {?} value
  4488. * @return {?}
  4489. */
  4490. function (value) {
  4491. if (value) {
  4492. /** @type {?} */
  4493. var dateParts = value.trim().split('-');
  4494. if (dateParts.length === 1 && isNumber(dateParts[0])) {
  4495. return { year: toInteger(dateParts[0]), month: null, day: null };
  4496. }
  4497. else if (dateParts.length === 2 && isNumber(dateParts[0]) && isNumber(dateParts[1])) {
  4498. return { year: toInteger(dateParts[0]), month: toInteger(dateParts[1]), day: null };
  4499. }
  4500. else if (dateParts.length === 3 && isNumber(dateParts[0]) && isNumber(dateParts[1]) && isNumber(dateParts[2])) {
  4501. return { year: toInteger(dateParts[0]), month: toInteger(dateParts[1]), day: toInteger(dateParts[2]) };
  4502. }
  4503. }
  4504. return null;
  4505. };
  4506. /**
  4507. * @param {?} date
  4508. * @return {?}
  4509. */
  4510. NgbDateISOParserFormatter.prototype.format = /**
  4511. * @param {?} date
  4512. * @return {?}
  4513. */
  4514. function (date) {
  4515. return date ?
  4516. date.year + "-" + (isNumber(date.month) ? padNumber(date.month) : '') + "-" + (isNumber(date.day) ? padNumber(date.day) : '') :
  4517. '';
  4518. };
  4519. NgbDateISOParserFormatter.decorators = [
  4520. { type: core.Injectable }
  4521. ];
  4522. return NgbDateISOParserFormatter;
  4523. }(NgbDateParserFormatter));
  4524. /**
  4525. * @fileoverview added by tsickle
  4526. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4527. */
  4528. /**
  4529. * A configuration service for the [`NgbDatepickerInput`](#/components/datepicker/api#NgbDatepicker) component.
  4530. *
  4531. * You can inject this service, typically in your root component, and customize the values of its properties in
  4532. * order to provide default values for all the datepicker inputs used in the application.
  4533. *
  4534. * \@since 5.2.0
  4535. */
  4536. var NgbInputDatepickerConfig = /** @class */ (function (_super) {
  4537. __extends(NgbInputDatepickerConfig, _super);
  4538. function NgbInputDatepickerConfig() {
  4539. var _this = _super !== null && _super.apply(this, arguments) || this;
  4540. _this.autoClose = true;
  4541. _this.placement = ['bottom-left', 'bottom-right', 'top-left', 'top-right'];
  4542. _this.restoreFocus = true;
  4543. return _this;
  4544. }
  4545. NgbInputDatepickerConfig.decorators = [
  4546. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  4547. ];
  4548. /** @nocollapse */ NgbInputDatepickerConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbInputDatepickerConfig_Factory() { return new NgbInputDatepickerConfig(); }, token: NgbInputDatepickerConfig, providedIn: "root" });
  4549. return NgbInputDatepickerConfig;
  4550. }(NgbDatepickerConfig));
  4551. /**
  4552. * @fileoverview added by tsickle
  4553. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  4554. */
  4555. /** @type {?} */
  4556. var NGB_DATEPICKER_VALUE_ACCESSOR$1 = {
  4557. provide: forms.NG_VALUE_ACCESSOR,
  4558. useExisting: core.forwardRef((/**
  4559. * @return {?}
  4560. */
  4561. function () { return NgbInputDatepicker; })),
  4562. multi: true
  4563. };
  4564. /** @type {?} */
  4565. var NGB_DATEPICKER_VALIDATOR = {
  4566. provide: forms.NG_VALIDATORS,
  4567. useExisting: core.forwardRef((/**
  4568. * @return {?}
  4569. */
  4570. function () { return NgbInputDatepicker; })),
  4571. multi: true
  4572. };
  4573. /**
  4574. * A directive that allows to stick a datepicker popup to an input field.
  4575. *
  4576. * Manages interaction with the input field itself, does value formatting and provides forms integration.
  4577. */
  4578. var NgbInputDatepicker = /** @class */ (function () {
  4579. function NgbInputDatepicker(_parserFormatter, _elRef, _vcRef, _renderer, _cfr, _ngZone, _calendar, _dateAdapter, _document, _changeDetector, config) {
  4580. var _this = this;
  4581. this._parserFormatter = _parserFormatter;
  4582. this._elRef = _elRef;
  4583. this._vcRef = _vcRef;
  4584. this._renderer = _renderer;
  4585. this._cfr = _cfr;
  4586. this._ngZone = _ngZone;
  4587. this._calendar = _calendar;
  4588. this._dateAdapter = _dateAdapter;
  4589. this._document = _document;
  4590. this._changeDetector = _changeDetector;
  4591. this._cRef = null;
  4592. this._disabled = false;
  4593. this._elWithFocus = null;
  4594. /**
  4595. * An event emitted when user selects a date using keyboard or mouse.
  4596. *
  4597. * The payload of the event is currently selected `NgbDate`.
  4598. *
  4599. * \@since 1.1.1
  4600. */
  4601. this.dateSelect = new core.EventEmitter();
  4602. /**
  4603. * Event emitted right after the navigation happens and displayed month changes.
  4604. *
  4605. * See [`NgbDatepickerNavigateEvent`](#/components/datepicker/api#NgbDatepickerNavigateEvent) for the payload info.
  4606. */
  4607. this.navigate = new core.EventEmitter();
  4608. /**
  4609. * An event fired after closing datepicker window.
  4610. *
  4611. * \@since 4.2.0
  4612. */
  4613. this.closed = new core.EventEmitter();
  4614. this._onChange = (/**
  4615. * @param {?} _
  4616. * @return {?}
  4617. */
  4618. function (_) { });
  4619. this._onTouched = (/**
  4620. * @return {?}
  4621. */
  4622. function () { });
  4623. this._validatorChange = (/**
  4624. * @return {?}
  4625. */
  4626. function () { });
  4627. ['autoClose', 'container', 'positionTarget', 'placement'].forEach((/**
  4628. * @param {?} input
  4629. * @return {?}
  4630. */
  4631. function (input) { return _this[input] = config[input]; }));
  4632. this._zoneSubscription = _ngZone.onStable.subscribe((/**
  4633. * @return {?}
  4634. */
  4635. function () { return _this._updatePopupPosition(); }));
  4636. }
  4637. Object.defineProperty(NgbInputDatepicker.prototype, "disabled", {
  4638. get: /**
  4639. * @return {?}
  4640. */
  4641. function () {
  4642. return this._disabled;
  4643. },
  4644. set: /**
  4645. * @param {?} value
  4646. * @return {?}
  4647. */
  4648. function (value) {
  4649. this._disabled = value === '' || (value && value !== 'false');
  4650. if (this.isOpen()) {
  4651. this._cRef.instance.setDisabledState(this._disabled);
  4652. }
  4653. },
  4654. enumerable: true,
  4655. configurable: true
  4656. });
  4657. /**
  4658. * @param {?} fn
  4659. * @return {?}
  4660. */
  4661. NgbInputDatepicker.prototype.registerOnChange = /**
  4662. * @param {?} fn
  4663. * @return {?}
  4664. */
  4665. function (fn) { this._onChange = fn; };
  4666. /**
  4667. * @param {?} fn
  4668. * @return {?}
  4669. */
  4670. NgbInputDatepicker.prototype.registerOnTouched = /**
  4671. * @param {?} fn
  4672. * @return {?}
  4673. */
  4674. function (fn) { this._onTouched = fn; };
  4675. /**
  4676. * @param {?} fn
  4677. * @return {?}
  4678. */
  4679. NgbInputDatepicker.prototype.registerOnValidatorChange = /**
  4680. * @param {?} fn
  4681. * @return {?}
  4682. */
  4683. function (fn) { this._validatorChange = fn; };
  4684. /**
  4685. * @param {?} isDisabled
  4686. * @return {?}
  4687. */
  4688. NgbInputDatepicker.prototype.setDisabledState = /**
  4689. * @param {?} isDisabled
  4690. * @return {?}
  4691. */
  4692. function (isDisabled) { this.disabled = isDisabled; };
  4693. /**
  4694. * @param {?} c
  4695. * @return {?}
  4696. */
  4697. NgbInputDatepicker.prototype.validate = /**
  4698. * @param {?} c
  4699. * @return {?}
  4700. */
  4701. function (c) {
  4702. /** @type {?} */
  4703. var value = c.value;
  4704. if (value === null || value === undefined) {
  4705. return null;
  4706. }
  4707. /** @type {?} */
  4708. var ngbDate = this._fromDateStruct(this._dateAdapter.fromModel(value));
  4709. if (!this._calendar.isValid(ngbDate)) {
  4710. return { 'ngbDate': { invalid: c.value } };
  4711. }
  4712. if (this.minDate && ngbDate.before(NgbDate.from(this.minDate))) {
  4713. return { 'ngbDate': { requiredBefore: this.minDate } };
  4714. }
  4715. if (this.maxDate && ngbDate.after(NgbDate.from(this.maxDate))) {
  4716. return { 'ngbDate': { requiredAfter: this.maxDate } };
  4717. }
  4718. };
  4719. /**
  4720. * @param {?} value
  4721. * @return {?}
  4722. */
  4723. NgbInputDatepicker.prototype.writeValue = /**
  4724. * @param {?} value
  4725. * @return {?}
  4726. */
  4727. function (value) {
  4728. this._model = this._fromDateStruct(this._dateAdapter.fromModel(value));
  4729. this._writeModelValue(this._model);
  4730. };
  4731. /**
  4732. * @param {?} value
  4733. * @param {?=} updateView
  4734. * @return {?}
  4735. */
  4736. NgbInputDatepicker.prototype.manualDateChange = /**
  4737. * @param {?} value
  4738. * @param {?=} updateView
  4739. * @return {?}
  4740. */
  4741. function (value, updateView) {
  4742. if (updateView === void 0) { updateView = false; }
  4743. /** @type {?} */
  4744. var inputValueChanged = value !== this._inputValue;
  4745. if (inputValueChanged) {
  4746. this._inputValue = value;
  4747. this._model = this._fromDateStruct(this._parserFormatter.parse(value));
  4748. }
  4749. if (inputValueChanged || !updateView) {
  4750. this._onChange(this._model ? this._dateAdapter.toModel(this._model) : (value === '' ? null : value));
  4751. }
  4752. if (updateView && this._model) {
  4753. this._writeModelValue(this._model);
  4754. }
  4755. };
  4756. /**
  4757. * @return {?}
  4758. */
  4759. NgbInputDatepicker.prototype.isOpen = /**
  4760. * @return {?}
  4761. */
  4762. function () { return !!this._cRef; };
  4763. /**
  4764. * Opens the datepicker popup.
  4765. *
  4766. * If the related form control contains a valid date, the corresponding month will be opened.
  4767. */
  4768. /**
  4769. * Opens the datepicker popup.
  4770. *
  4771. * If the related form control contains a valid date, the corresponding month will be opened.
  4772. * @return {?}
  4773. */
  4774. NgbInputDatepicker.prototype.open = /**
  4775. * Opens the datepicker popup.
  4776. *
  4777. * If the related form control contains a valid date, the corresponding month will be opened.
  4778. * @return {?}
  4779. */
  4780. function () {
  4781. var _this = this;
  4782. if (!this.isOpen()) {
  4783. /** @type {?} */
  4784. var cf = this._cfr.resolveComponentFactory(NgbDatepicker);
  4785. this._cRef = this._vcRef.createComponent(cf);
  4786. this._applyPopupStyling(this._cRef.location.nativeElement);
  4787. this._applyDatepickerInputs(this._cRef.instance);
  4788. this._subscribeForDatepickerOutputs(this._cRef.instance);
  4789. this._cRef.instance.ngOnInit();
  4790. this._cRef.instance.writeValue(this._dateAdapter.toModel(this._model));
  4791. // date selection event handling
  4792. this._cRef.instance.registerOnChange((/**
  4793. * @param {?} selectedDate
  4794. * @return {?}
  4795. */
  4796. function (selectedDate) {
  4797. _this.writeValue(selectedDate);
  4798. _this._onChange(selectedDate);
  4799. _this._onTouched();
  4800. }));
  4801. this._cRef.changeDetectorRef.detectChanges();
  4802. this._cRef.instance.setDisabledState(this.disabled);
  4803. if (this.container === 'body') {
  4804. window.document.querySelector(this.container).appendChild(this._cRef.location.nativeElement);
  4805. }
  4806. // focus handling
  4807. this._elWithFocus = this._document.activeElement;
  4808. ngbFocusTrap(this._ngZone, this._cRef.location.nativeElement, this.closed, true);
  4809. this._cRef.instance.focus();
  4810. ngbAutoClose(this._ngZone, this._document, this.autoClose, (/**
  4811. * @return {?}
  4812. */
  4813. function () { return _this.close(); }), this.closed, [], [this._elRef.nativeElement, this._cRef.location.nativeElement]);
  4814. }
  4815. };
  4816. /**
  4817. * Closes the datepicker popup.
  4818. */
  4819. /**
  4820. * Closes the datepicker popup.
  4821. * @return {?}
  4822. */
  4823. NgbInputDatepicker.prototype.close = /**
  4824. * Closes the datepicker popup.
  4825. * @return {?}
  4826. */
  4827. function () {
  4828. if (this.isOpen()) {
  4829. this._vcRef.remove(this._vcRef.indexOf(this._cRef.hostView));
  4830. this._cRef = null;
  4831. this.closed.emit();
  4832. this._changeDetector.markForCheck();
  4833. // restore focus
  4834. /** @type {?} */
  4835. var elementToFocus = this._elWithFocus;
  4836. if (isString(this.restoreFocus)) {
  4837. elementToFocus = this._document.querySelector(this.restoreFocus);
  4838. }
  4839. else if (this.restoreFocus !== undefined) {
  4840. elementToFocus = this.restoreFocus;
  4841. }
  4842. // in IE document.activeElement can contain an object without 'focus()' sometimes
  4843. if (elementToFocus && elementToFocus['focus']) {
  4844. elementToFocus.focus();
  4845. }
  4846. else {
  4847. this._document.body.focus();
  4848. }
  4849. }
  4850. };
  4851. /**
  4852. * Toggles the datepicker popup.
  4853. */
  4854. /**
  4855. * Toggles the datepicker popup.
  4856. * @return {?}
  4857. */
  4858. NgbInputDatepicker.prototype.toggle = /**
  4859. * Toggles the datepicker popup.
  4860. * @return {?}
  4861. */
  4862. function () {
  4863. if (this.isOpen()) {
  4864. this.close();
  4865. }
  4866. else {
  4867. this.open();
  4868. }
  4869. };
  4870. /**
  4871. * Navigates to the provided date.
  4872. *
  4873. * With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.
  4874. * If nothing or invalid date provided calendar will open current month.
  4875. *
  4876. * Use the `[startDate]` input as an alternative.
  4877. */
  4878. /**
  4879. * Navigates to the provided date.
  4880. *
  4881. * With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.
  4882. * If nothing or invalid date provided calendar will open current month.
  4883. *
  4884. * Use the `[startDate]` input as an alternative.
  4885. * @param {?=} date
  4886. * @return {?}
  4887. */
  4888. NgbInputDatepicker.prototype.navigateTo = /**
  4889. * Navigates to the provided date.
  4890. *
  4891. * With the default calendar we use ISO 8601: 'month' is 1=Jan ... 12=Dec.
  4892. * If nothing or invalid date provided calendar will open current month.
  4893. *
  4894. * Use the `[startDate]` input as an alternative.
  4895. * @param {?=} date
  4896. * @return {?}
  4897. */
  4898. function (date) {
  4899. if (this.isOpen()) {
  4900. this._cRef.instance.navigateTo(date);
  4901. }
  4902. };
  4903. /**
  4904. * @return {?}
  4905. */
  4906. NgbInputDatepicker.prototype.onBlur = /**
  4907. * @return {?}
  4908. */
  4909. function () { this._onTouched(); };
  4910. /**
  4911. * @return {?}
  4912. */
  4913. NgbInputDatepicker.prototype.onFocus = /**
  4914. * @return {?}
  4915. */
  4916. function () { this._elWithFocus = this._elRef.nativeElement; };
  4917. /**
  4918. * @param {?} changes
  4919. * @return {?}
  4920. */
  4921. NgbInputDatepicker.prototype.ngOnChanges = /**
  4922. * @param {?} changes
  4923. * @return {?}
  4924. */
  4925. function (changes) {
  4926. if (changes['minDate'] || changes['maxDate']) {
  4927. this._validatorChange();
  4928. if (this.isOpen()) {
  4929. if (changes['minDate']) {
  4930. this._cRef.instance.minDate = this._dateAdapter.toModel(changes.minDate.currentValue);
  4931. }
  4932. if (changes['maxDate']) {
  4933. this._cRef.instance.maxDate = this._dateAdapter.toModel(changes.maxDate.currentValue);
  4934. }
  4935. this._cRef.instance.ngOnChanges(changes);
  4936. }
  4937. }
  4938. };
  4939. /**
  4940. * @return {?}
  4941. */
  4942. NgbInputDatepicker.prototype.ngOnDestroy = /**
  4943. * @return {?}
  4944. */
  4945. function () {
  4946. this.close();
  4947. this._zoneSubscription.unsubscribe();
  4948. };
  4949. /**
  4950. * @private
  4951. * @param {?} datepickerInstance
  4952. * @return {?}
  4953. */
  4954. NgbInputDatepicker.prototype._applyDatepickerInputs = /**
  4955. * @private
  4956. * @param {?} datepickerInstance
  4957. * @return {?}
  4958. */
  4959. function (datepickerInstance) {
  4960. var _this = this;
  4961. ['dayTemplate', 'dayTemplateData', 'displayMonths', 'firstDayOfWeek', 'footerTemplate', 'markDisabled', 'minDate',
  4962. 'maxDate', 'navigation', 'outsideDays', 'showNavigation', 'showWeekdays', 'showWeekNumbers']
  4963. .forEach((/**
  4964. * @param {?} optionName
  4965. * @return {?}
  4966. */
  4967. function (optionName) {
  4968. if (_this[optionName] !== undefined) {
  4969. datepickerInstance[optionName] = _this[optionName];
  4970. }
  4971. }));
  4972. datepickerInstance.startDate = this.startDate || this._model;
  4973. };
  4974. /**
  4975. * @private
  4976. * @param {?} nativeElement
  4977. * @return {?}
  4978. */
  4979. NgbInputDatepicker.prototype._applyPopupStyling = /**
  4980. * @private
  4981. * @param {?} nativeElement
  4982. * @return {?}
  4983. */
  4984. function (nativeElement) {
  4985. this._renderer.addClass(nativeElement, 'dropdown-menu');
  4986. this._renderer.addClass(nativeElement, 'show');
  4987. if (this.container === 'body') {
  4988. this._renderer.addClass(nativeElement, 'ngb-dp-body');
  4989. }
  4990. };
  4991. /**
  4992. * @private
  4993. * @param {?} datepickerInstance
  4994. * @return {?}
  4995. */
  4996. NgbInputDatepicker.prototype._subscribeForDatepickerOutputs = /**
  4997. * @private
  4998. * @param {?} datepickerInstance
  4999. * @return {?}
  5000. */
  5001. function (datepickerInstance) {
  5002. var _this = this;
  5003. datepickerInstance.navigate.subscribe((/**
  5004. * @param {?} navigateEvent
  5005. * @return {?}
  5006. */
  5007. function (navigateEvent) { return _this.navigate.emit(navigateEvent); }));
  5008. datepickerInstance.dateSelect.subscribe((/**
  5009. * @param {?} date
  5010. * @return {?}
  5011. */
  5012. function (date) {
  5013. _this.dateSelect.emit(date);
  5014. if (_this.autoClose === true || _this.autoClose === 'inside') {
  5015. _this.close();
  5016. }
  5017. }));
  5018. };
  5019. /**
  5020. * @private
  5021. * @param {?} model
  5022. * @return {?}
  5023. */
  5024. NgbInputDatepicker.prototype._writeModelValue = /**
  5025. * @private
  5026. * @param {?} model
  5027. * @return {?}
  5028. */
  5029. function (model) {
  5030. /** @type {?} */
  5031. var value = this._parserFormatter.format(model);
  5032. this._inputValue = value;
  5033. this._renderer.setProperty(this._elRef.nativeElement, 'value', value);
  5034. if (this.isOpen()) {
  5035. this._cRef.instance.writeValue(this._dateAdapter.toModel(model));
  5036. this._onTouched();
  5037. }
  5038. };
  5039. /**
  5040. * @private
  5041. * @param {?} date
  5042. * @return {?}
  5043. */
  5044. NgbInputDatepicker.prototype._fromDateStruct = /**
  5045. * @private
  5046. * @param {?} date
  5047. * @return {?}
  5048. */
  5049. function (date) {
  5050. /** @type {?} */
  5051. var ngbDate = date ? new NgbDate(date.year, date.month, date.day) : null;
  5052. return this._calendar.isValid(ngbDate) ? ngbDate : null;
  5053. };
  5054. /**
  5055. * @private
  5056. * @return {?}
  5057. */
  5058. NgbInputDatepicker.prototype._updatePopupPosition = /**
  5059. * @private
  5060. * @return {?}
  5061. */
  5062. function () {
  5063. if (!this._cRef) {
  5064. return;
  5065. }
  5066. /** @type {?} */
  5067. var hostElement;
  5068. if (isString(this.positionTarget)) {
  5069. hostElement = this._document.querySelector(this.positionTarget);
  5070. }
  5071. else if (this.positionTarget instanceof HTMLElement) {
  5072. hostElement = this.positionTarget;
  5073. }
  5074. else {
  5075. hostElement = this._elRef.nativeElement;
  5076. }
  5077. if (this.positionTarget && !hostElement) {
  5078. throw new Error('ngbDatepicker could not find element declared in [positionTarget] to position against.');
  5079. }
  5080. positionElements(hostElement, this._cRef.location.nativeElement, this.placement, this.container === 'body');
  5081. };
  5082. NgbInputDatepicker.decorators = [
  5083. { type: core.Directive, args: [{
  5084. selector: 'input[ngbDatepicker]',
  5085. exportAs: 'ngbDatepicker',
  5086. host: {
  5087. '(input)': 'manualDateChange($event.target.value)',
  5088. '(change)': 'manualDateChange($event.target.value, true)',
  5089. '(focus)': 'onFocus()',
  5090. '(blur)': 'onBlur()',
  5091. '[disabled]': 'disabled'
  5092. },
  5093. providers: [
  5094. NGB_DATEPICKER_VALUE_ACCESSOR$1, NGB_DATEPICKER_VALIDATOR,
  5095. { provide: NgbDatepickerConfig, useExisting: NgbInputDatepickerConfig }
  5096. ],
  5097. },] }
  5098. ];
  5099. /** @nocollapse */
  5100. NgbInputDatepicker.ctorParameters = function () { return [
  5101. { type: NgbDateParserFormatter },
  5102. { type: core.ElementRef },
  5103. { type: core.ViewContainerRef },
  5104. { type: core.Renderer2 },
  5105. { type: core.ComponentFactoryResolver },
  5106. { type: core.NgZone },
  5107. { type: NgbCalendar },
  5108. { type: NgbDateAdapter },
  5109. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  5110. { type: core.ChangeDetectorRef },
  5111. { type: NgbInputDatepickerConfig }
  5112. ]; };
  5113. NgbInputDatepicker.propDecorators = {
  5114. autoClose: [{ type: core.Input }],
  5115. dayTemplate: [{ type: core.Input }],
  5116. dayTemplateData: [{ type: core.Input }],
  5117. displayMonths: [{ type: core.Input }],
  5118. firstDayOfWeek: [{ type: core.Input }],
  5119. footerTemplate: [{ type: core.Input }],
  5120. markDisabled: [{ type: core.Input }],
  5121. minDate: [{ type: core.Input }],
  5122. maxDate: [{ type: core.Input }],
  5123. navigation: [{ type: core.Input }],
  5124. outsideDays: [{ type: core.Input }],
  5125. placement: [{ type: core.Input }],
  5126. restoreFocus: [{ type: core.Input }],
  5127. showWeekdays: [{ type: core.Input }],
  5128. showWeekNumbers: [{ type: core.Input }],
  5129. startDate: [{ type: core.Input }],
  5130. container: [{ type: core.Input }],
  5131. positionTarget: [{ type: core.Input }],
  5132. dateSelect: [{ type: core.Output }],
  5133. navigate: [{ type: core.Output }],
  5134. closed: [{ type: core.Output }],
  5135. disabled: [{ type: core.Input }]
  5136. };
  5137. return NgbInputDatepicker;
  5138. }());
  5139. /**
  5140. * @fileoverview added by tsickle
  5141. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5142. */
  5143. var NgbDatepickerDayView = /** @class */ (function () {
  5144. function NgbDatepickerDayView(i18n) {
  5145. this.i18n = i18n;
  5146. }
  5147. /**
  5148. * @return {?}
  5149. */
  5150. NgbDatepickerDayView.prototype.isMuted = /**
  5151. * @return {?}
  5152. */
  5153. function () { return !this.selected && (this.date.month !== this.currentMonth || this.disabled); };
  5154. NgbDatepickerDayView.decorators = [
  5155. { type: core.Component, args: [{
  5156. selector: '[ngbDatepickerDayView]',
  5157. changeDetection: core.ChangeDetectionStrategy.OnPush,
  5158. encapsulation: core.ViewEncapsulation.None,
  5159. host: {
  5160. 'class': 'btn-light',
  5161. '[class.bg-primary]': 'selected',
  5162. '[class.text-white]': 'selected',
  5163. '[class.text-muted]': 'isMuted()',
  5164. '[class.outside]': 'isMuted()',
  5165. '[class.active]': 'focused'
  5166. },
  5167. template: "{{ i18n.getDayNumerals(date) }}",
  5168. styles: ["[ngbDatepickerDayView]{text-align:center;width:2rem;height:2rem;line-height:2rem;border-radius:.25rem;background:0 0}[ngbDatepickerDayView].outside{opacity:.5}"]
  5169. }] }
  5170. ];
  5171. /** @nocollapse */
  5172. NgbDatepickerDayView.ctorParameters = function () { return [
  5173. { type: NgbDatepickerI18n }
  5174. ]; };
  5175. NgbDatepickerDayView.propDecorators = {
  5176. currentMonth: [{ type: core.Input }],
  5177. date: [{ type: core.Input }],
  5178. disabled: [{ type: core.Input }],
  5179. focused: [{ type: core.Input }],
  5180. selected: [{ type: core.Input }]
  5181. };
  5182. return NgbDatepickerDayView;
  5183. }());
  5184. /**
  5185. * @fileoverview added by tsickle
  5186. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5187. */
  5188. var NgbDatepickerNavigationSelect = /** @class */ (function () {
  5189. function NgbDatepickerNavigationSelect(i18n, _renderer) {
  5190. this.i18n = i18n;
  5191. this._renderer = _renderer;
  5192. this.select = new core.EventEmitter();
  5193. this._month = -1;
  5194. this._year = -1;
  5195. }
  5196. /**
  5197. * @param {?} month
  5198. * @return {?}
  5199. */
  5200. NgbDatepickerNavigationSelect.prototype.changeMonth = /**
  5201. * @param {?} month
  5202. * @return {?}
  5203. */
  5204. function (month) { this.select.emit(new NgbDate(this.date.year, toInteger(month), 1)); };
  5205. /**
  5206. * @param {?} year
  5207. * @return {?}
  5208. */
  5209. NgbDatepickerNavigationSelect.prototype.changeYear = /**
  5210. * @param {?} year
  5211. * @return {?}
  5212. */
  5213. function (year) { this.select.emit(new NgbDate(toInteger(year), this.date.month, 1)); };
  5214. /**
  5215. * @return {?}
  5216. */
  5217. NgbDatepickerNavigationSelect.prototype.ngAfterViewChecked = /**
  5218. * @return {?}
  5219. */
  5220. function () {
  5221. if (this.date) {
  5222. if (this.date.month !== this._month) {
  5223. this._month = this.date.month;
  5224. this._renderer.setProperty(this.monthSelect.nativeElement, 'value', this._month);
  5225. }
  5226. if (this.date.year !== this._year) {
  5227. this._year = this.date.year;
  5228. this._renderer.setProperty(this.yearSelect.nativeElement, 'value', this._year);
  5229. }
  5230. }
  5231. };
  5232. NgbDatepickerNavigationSelect.decorators = [
  5233. { type: core.Component, args: [{
  5234. selector: 'ngb-datepicker-navigation-select',
  5235. changeDetection: core.ChangeDetectionStrategy.OnPush,
  5236. encapsulation: core.ViewEncapsulation.None,
  5237. template: "\n <select #month\n [disabled]=\"disabled\"\n class=\"custom-select\"\n i18n-aria-label=\"@@ngb.datepicker.select-month\" aria-label=\"Select month\"\n i18n-title=\"@@ngb.datepicker.select-month\" title=\"Select month\"\n (change)=\"changeMonth($event.target.value)\">\n <option *ngFor=\"let m of months\" [attr.aria-label]=\"i18n.getMonthFullName(m, date?.year)\"\n [value]=\"m\">{{ i18n.getMonthShortName(m, date?.year) }}</option>\n </select><select #year\n [disabled]=\"disabled\"\n class=\"custom-select\"\n i18n-aria-label=\"@@ngb.datepicker.select-year\" aria-label=\"Select year\"\n i18n-title=\"@@ngb.datepicker.select-year\" title=\"Select year\"\n (change)=\"changeYear($event.target.value)\">\n <option *ngFor=\"let y of years\" [value]=\"y\">{{ i18n.getYearNumerals(y) }}</option>\n </select>\n ",
  5238. styles: ["ngb-datepicker-navigation-select>.custom-select{-ms-flex:1 1 auto;flex:1 1 auto;padding:0 .5rem;font-size:.875rem;height:1.85rem}ngb-datepicker-navigation-select>.custom-select:focus{z-index:1}ngb-datepicker-navigation-select>.custom-select::-ms-value{background-color:transparent!important}"]
  5239. }] }
  5240. ];
  5241. /** @nocollapse */
  5242. NgbDatepickerNavigationSelect.ctorParameters = function () { return [
  5243. { type: NgbDatepickerI18n },
  5244. { type: core.Renderer2 }
  5245. ]; };
  5246. NgbDatepickerNavigationSelect.propDecorators = {
  5247. date: [{ type: core.Input }],
  5248. disabled: [{ type: core.Input }],
  5249. months: [{ type: core.Input }],
  5250. years: [{ type: core.Input }],
  5251. select: [{ type: core.Output }],
  5252. monthSelect: [{ type: core.ViewChild, args: ['month', { static: true, read: core.ElementRef },] }],
  5253. yearSelect: [{ type: core.ViewChild, args: ['year', { static: true, read: core.ElementRef },] }]
  5254. };
  5255. return NgbDatepickerNavigationSelect;
  5256. }());
  5257. /**
  5258. * @fileoverview added by tsickle
  5259. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5260. */
  5261. /**
  5262. * @abstract
  5263. */
  5264. var NgbCalendarHijri = /** @class */ (function (_super) {
  5265. __extends(NgbCalendarHijri, _super);
  5266. function NgbCalendarHijri() {
  5267. return _super !== null && _super.apply(this, arguments) || this;
  5268. }
  5269. /**
  5270. * @return {?}
  5271. */
  5272. NgbCalendarHijri.prototype.getDaysPerWeek = /**
  5273. * @return {?}
  5274. */
  5275. function () { return 7; };
  5276. /**
  5277. * @return {?}
  5278. */
  5279. NgbCalendarHijri.prototype.getMonths = /**
  5280. * @return {?}
  5281. */
  5282. function () { return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; };
  5283. /**
  5284. * @return {?}
  5285. */
  5286. NgbCalendarHijri.prototype.getWeeksPerMonth = /**
  5287. * @return {?}
  5288. */
  5289. function () { return 6; };
  5290. /**
  5291. * @param {?} date
  5292. * @param {?=} period
  5293. * @param {?=} number
  5294. * @return {?}
  5295. */
  5296. NgbCalendarHijri.prototype.getNext = /**
  5297. * @param {?} date
  5298. * @param {?=} period
  5299. * @param {?=} number
  5300. * @return {?}
  5301. */
  5302. function (date, period, number) {
  5303. if (period === void 0) { period = 'd'; }
  5304. if (number === void 0) { number = 1; }
  5305. date = new NgbDate(date.year, date.month, date.day);
  5306. switch (period) {
  5307. case 'y':
  5308. date = this._setYear(date, date.year + number);
  5309. date.month = 1;
  5310. date.day = 1;
  5311. return date;
  5312. case 'm':
  5313. date = this._setMonth(date, date.month + number);
  5314. date.day = 1;
  5315. return date;
  5316. case 'd':
  5317. return this._setDay(date, date.day + number);
  5318. default:
  5319. return date;
  5320. }
  5321. };
  5322. /**
  5323. * @param {?} date
  5324. * @param {?=} period
  5325. * @param {?=} number
  5326. * @return {?}
  5327. */
  5328. NgbCalendarHijri.prototype.getPrev = /**
  5329. * @param {?} date
  5330. * @param {?=} period
  5331. * @param {?=} number
  5332. * @return {?}
  5333. */
  5334. function (date, period, number) {
  5335. if (period === void 0) { period = 'd'; }
  5336. if (number === void 0) { number = 1; }
  5337. return this.getNext(date, period, -number);
  5338. };
  5339. /**
  5340. * @param {?} date
  5341. * @return {?}
  5342. */
  5343. NgbCalendarHijri.prototype.getWeekday = /**
  5344. * @param {?} date
  5345. * @return {?}
  5346. */
  5347. function (date) {
  5348. /** @type {?} */
  5349. var day = this.toGregorian(date).getDay();
  5350. // in JS Date Sun=0, in ISO 8601 Sun=7
  5351. return day === 0 ? 7 : day;
  5352. };
  5353. /**
  5354. * @param {?} week
  5355. * @param {?} firstDayOfWeek
  5356. * @return {?}
  5357. */
  5358. NgbCalendarHijri.prototype.getWeekNumber = /**
  5359. * @param {?} week
  5360. * @param {?} firstDayOfWeek
  5361. * @return {?}
  5362. */
  5363. function (week, firstDayOfWeek) {
  5364. // in JS Date Sun=0, in ISO 8601 Sun=7
  5365. if (firstDayOfWeek === 7) {
  5366. firstDayOfWeek = 0;
  5367. }
  5368. /** @type {?} */
  5369. var thursdayIndex = (4 + 7 - firstDayOfWeek) % 7;
  5370. /** @type {?} */
  5371. var date = week[thursdayIndex];
  5372. /** @type {?} */
  5373. var jsDate = this.toGregorian(date);
  5374. jsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday
  5375. // Thursday
  5376. /** @type {?} */
  5377. var time = jsDate.getTime();
  5378. /** @type {?} */
  5379. var MuhDate = this.toGregorian(new NgbDate(date.year, 1, 1));
  5380. return Math.floor(Math.round((time - MuhDate.getTime()) / 86400000) / 7) + 1;
  5381. };
  5382. /**
  5383. * @return {?}
  5384. */
  5385. NgbCalendarHijri.prototype.getToday = /**
  5386. * @return {?}
  5387. */
  5388. function () { return this.fromGregorian(new Date()); };
  5389. /**
  5390. * @param {?} date
  5391. * @return {?}
  5392. */
  5393. NgbCalendarHijri.prototype.isValid = /**
  5394. * @param {?} date
  5395. * @return {?}
  5396. */
  5397. function (date) {
  5398. return date && isNumber(date.year) && isNumber(date.month) && isNumber(date.day) &&
  5399. !isNaN(this.toGregorian(date).getTime());
  5400. };
  5401. /**
  5402. * @private
  5403. * @param {?} date
  5404. * @param {?} day
  5405. * @return {?}
  5406. */
  5407. NgbCalendarHijri.prototype._setDay = /**
  5408. * @private
  5409. * @param {?} date
  5410. * @param {?} day
  5411. * @return {?}
  5412. */
  5413. function (date, day) {
  5414. day = +day;
  5415. /** @type {?} */
  5416. var mDays = this.getDaysPerMonth(date.month, date.year);
  5417. if (day <= 0) {
  5418. while (day <= 0) {
  5419. date = this._setMonth(date, date.month - 1);
  5420. mDays = this.getDaysPerMonth(date.month, date.year);
  5421. day += mDays;
  5422. }
  5423. }
  5424. else if (day > mDays) {
  5425. while (day > mDays) {
  5426. day -= mDays;
  5427. date = this._setMonth(date, date.month + 1);
  5428. mDays = this.getDaysPerMonth(date.month, date.year);
  5429. }
  5430. }
  5431. date.day = day;
  5432. return date;
  5433. };
  5434. /**
  5435. * @private
  5436. * @param {?} date
  5437. * @param {?} month
  5438. * @return {?}
  5439. */
  5440. NgbCalendarHijri.prototype._setMonth = /**
  5441. * @private
  5442. * @param {?} date
  5443. * @param {?} month
  5444. * @return {?}
  5445. */
  5446. function (date, month) {
  5447. month = +month;
  5448. date.year = date.year + Math.floor((month - 1) / 12);
  5449. date.month = Math.floor(((month - 1) % 12 + 12) % 12) + 1;
  5450. return date;
  5451. };
  5452. /**
  5453. * @private
  5454. * @param {?} date
  5455. * @param {?} year
  5456. * @return {?}
  5457. */
  5458. NgbCalendarHijri.prototype._setYear = /**
  5459. * @private
  5460. * @param {?} date
  5461. * @param {?} year
  5462. * @return {?}
  5463. */
  5464. function (date, year) {
  5465. date.year = +year;
  5466. return date;
  5467. };
  5468. NgbCalendarHijri.decorators = [
  5469. { type: core.Injectable }
  5470. ];
  5471. return NgbCalendarHijri;
  5472. }(NgbCalendar));
  5473. /**
  5474. * @fileoverview added by tsickle
  5475. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5476. */
  5477. /**
  5478. * Checks if islamic year is a leap year
  5479. * @param {?} hYear
  5480. * @return {?}
  5481. */
  5482. function isIslamicLeapYear(hYear) {
  5483. return (14 + 11 * hYear) % 30 < 11;
  5484. }
  5485. /**
  5486. * Checks if gregorian years is a leap year
  5487. * @param {?} gDate
  5488. * @return {?}
  5489. */
  5490. function isGregorianLeapYear(gDate) {
  5491. /** @type {?} */
  5492. var year = gDate.getFullYear();
  5493. return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
  5494. }
  5495. /**
  5496. * Returns the start of Hijri Month.
  5497. * `hMonth` is 0 for Muharram, 1 for Safar, etc.
  5498. * `hYear` is any Hijri hYear.
  5499. * @param {?} hYear
  5500. * @param {?} hMonth
  5501. * @return {?}
  5502. */
  5503. function getIslamicMonthStart(hYear, hMonth) {
  5504. return Math.ceil(29.5 * hMonth) + (hYear - 1) * 354 + Math.floor((3 + 11 * hYear) / 30.0);
  5505. }
  5506. /**
  5507. * Returns the start of Hijri year.
  5508. * `year` is any Hijri year.
  5509. * @param {?} year
  5510. * @return {?}
  5511. */
  5512. function getIslamicYearStart(year) {
  5513. return (year - 1) * 354 + Math.floor((3 + 11 * year) / 30.0);
  5514. }
  5515. /**
  5516. * @param {?} a
  5517. * @param {?} b
  5518. * @return {?}
  5519. */
  5520. function mod(a, b) {
  5521. return a - b * Math.floor(a / b);
  5522. }
  5523. /**
  5524. * The civil calendar is one type of Hijri calendars used in islamic countries.
  5525. * Uses a fixed cycle of alternating 29- and 30-day months,
  5526. * with a leap day added to the last month of 11 out of every 30 years.
  5527. * http://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types
  5528. * All the calculations here are based on the equations from "Calendrical Calculations" By Edward M. Reingold, Nachum
  5529. * Dershowitz.
  5530. * @type {?}
  5531. */
  5532. var GREGORIAN_EPOCH = 1721425.5;
  5533. /** @type {?} */
  5534. var ISLAMIC_EPOCH = 1948439.5;
  5535. var NgbCalendarIslamicCivil = /** @class */ (function (_super) {
  5536. __extends(NgbCalendarIslamicCivil, _super);
  5537. function NgbCalendarIslamicCivil() {
  5538. return _super !== null && _super.apply(this, arguments) || this;
  5539. }
  5540. /**
  5541. * Returns the equivalent islamic(civil) date value for a give input Gregorian date.
  5542. * `gDate` is a JS Date to be converted to Hijri.
  5543. */
  5544. /**
  5545. * Returns the equivalent islamic(civil) date value for a give input Gregorian date.
  5546. * `gDate` is a JS Date to be converted to Hijri.
  5547. * @param {?} gDate
  5548. * @return {?}
  5549. */
  5550. NgbCalendarIslamicCivil.prototype.fromGregorian = /**
  5551. * Returns the equivalent islamic(civil) date value for a give input Gregorian date.
  5552. * `gDate` is a JS Date to be converted to Hijri.
  5553. * @param {?} gDate
  5554. * @return {?}
  5555. */
  5556. function (gDate) {
  5557. /** @type {?} */
  5558. var gYear = gDate.getFullYear();
  5559. /** @type {?} */
  5560. var gMonth = gDate.getMonth();
  5561. /** @type {?} */
  5562. var gDay = gDate.getDate();
  5563. /** @type {?} */
  5564. var julianDay = GREGORIAN_EPOCH - 1 + 365 * (gYear - 1) + Math.floor((gYear - 1) / 4) +
  5565. -Math.floor((gYear - 1) / 100) + Math.floor((gYear - 1) / 400) +
  5566. Math.floor((367 * (gMonth + 1) - 362) / 12 + (gMonth + 1 <= 2 ? 0 : isGregorianLeapYear(gDate) ? -1 : -2) + gDay);
  5567. julianDay = Math.floor(julianDay) + 0.5;
  5568. /** @type {?} */
  5569. var days = julianDay - ISLAMIC_EPOCH;
  5570. /** @type {?} */
  5571. var hYear = Math.floor((30 * days + 10646) / 10631.0);
  5572. /** @type {?} */
  5573. var hMonth = Math.ceil((days - 29 - getIslamicYearStart(hYear)) / 29.5);
  5574. hMonth = Math.min(hMonth, 11);
  5575. /** @type {?} */
  5576. var hDay = Math.ceil(days - getIslamicMonthStart(hYear, hMonth)) + 1;
  5577. return new NgbDate(hYear, hMonth + 1, hDay);
  5578. };
  5579. /**
  5580. * Returns the equivalent JS date value for a give input islamic(civil) date.
  5581. * `hDate` is an islamic(civil) date to be converted to Gregorian.
  5582. */
  5583. /**
  5584. * Returns the equivalent JS date value for a give input islamic(civil) date.
  5585. * `hDate` is an islamic(civil) date to be converted to Gregorian.
  5586. * @param {?} hDate
  5587. * @return {?}
  5588. */
  5589. NgbCalendarIslamicCivil.prototype.toGregorian = /**
  5590. * Returns the equivalent JS date value for a give input islamic(civil) date.
  5591. * `hDate` is an islamic(civil) date to be converted to Gregorian.
  5592. * @param {?} hDate
  5593. * @return {?}
  5594. */
  5595. function (hDate) {
  5596. /** @type {?} */
  5597. var hYear = hDate.year;
  5598. /** @type {?} */
  5599. var hMonth = hDate.month - 1;
  5600. /** @type {?} */
  5601. var hDay = hDate.day;
  5602. /** @type {?} */
  5603. var julianDay = hDay + Math.ceil(29.5 * hMonth) + (hYear - 1) * 354 + Math.floor((3 + 11 * hYear) / 30) + ISLAMIC_EPOCH - 1;
  5604. /** @type {?} */
  5605. var wjd = Math.floor(julianDay - 0.5) + 0.5;
  5606. /** @type {?} */
  5607. var depoch = wjd - GREGORIAN_EPOCH;
  5608. /** @type {?} */
  5609. var quadricent = Math.floor(depoch / 146097);
  5610. /** @type {?} */
  5611. var dqc = mod(depoch, 146097);
  5612. /** @type {?} */
  5613. var cent = Math.floor(dqc / 36524);
  5614. /** @type {?} */
  5615. var dcent = mod(dqc, 36524);
  5616. /** @type {?} */
  5617. var quad = Math.floor(dcent / 1461);
  5618. /** @type {?} */
  5619. var dquad = mod(dcent, 1461);
  5620. /** @type {?} */
  5621. var yindex = Math.floor(dquad / 365);
  5622. /** @type {?} */
  5623. var year = quadricent * 400 + cent * 100 + quad * 4 + yindex;
  5624. if (!(cent === 4 || yindex === 4)) {
  5625. year++;
  5626. }
  5627. /** @type {?} */
  5628. var gYearStart = GREGORIAN_EPOCH + 365 * (year - 1) + Math.floor((year - 1) / 4) - Math.floor((year - 1) / 100) +
  5629. Math.floor((year - 1) / 400);
  5630. /** @type {?} */
  5631. var yearday = wjd - gYearStart;
  5632. /** @type {?} */
  5633. var tjd = GREGORIAN_EPOCH - 1 + 365 * (year - 1) + Math.floor((year - 1) / 4) - Math.floor((year - 1) / 100) +
  5634. Math.floor((year - 1) / 400) + Math.floor(739 / 12 + (isGregorianLeapYear(new Date(year, 3, 1)) ? -1 : -2) + 1);
  5635. /** @type {?} */
  5636. var leapadj = wjd < tjd ? 0 : isGregorianLeapYear(new Date(year, 3, 1)) ? 1 : 2;
  5637. /** @type {?} */
  5638. var month = Math.floor(((yearday + leapadj) * 12 + 373) / 367);
  5639. /** @type {?} */
  5640. var tjd2 = GREGORIAN_EPOCH - 1 + 365 * (year - 1) + Math.floor((year - 1) / 4) - Math.floor((year - 1) / 100) +
  5641. Math.floor((year - 1) / 400) +
  5642. Math.floor((367 * month - 362) / 12 + (month <= 2 ? 0 : isGregorianLeapYear(new Date(year, month - 1, 1)) ? -1 : -2) +
  5643. 1);
  5644. /** @type {?} */
  5645. var day = wjd - tjd2 + 1;
  5646. return new Date(year, month - 1, day);
  5647. };
  5648. /**
  5649. * Returns the number of days in a specific Hijri month.
  5650. * `month` is 1 for Muharram, 2 for Safar, etc.
  5651. * `year` is any Hijri year.
  5652. */
  5653. /**
  5654. * Returns the number of days in a specific Hijri month.
  5655. * `month` is 1 for Muharram, 2 for Safar, etc.
  5656. * `year` is any Hijri year.
  5657. * @param {?} month
  5658. * @param {?} year
  5659. * @return {?}
  5660. */
  5661. NgbCalendarIslamicCivil.prototype.getDaysPerMonth = /**
  5662. * Returns the number of days in a specific Hijri month.
  5663. * `month` is 1 for Muharram, 2 for Safar, etc.
  5664. * `year` is any Hijri year.
  5665. * @param {?} month
  5666. * @param {?} year
  5667. * @return {?}
  5668. */
  5669. function (month, year) {
  5670. year = year + Math.floor(month / 13);
  5671. month = ((month - 1) % 12) + 1;
  5672. /** @type {?} */
  5673. var length = 29 + month % 2;
  5674. if (month === 12 && isIslamicLeapYear(year)) {
  5675. length++;
  5676. }
  5677. return length;
  5678. };
  5679. NgbCalendarIslamicCivil.decorators = [
  5680. { type: core.Injectable }
  5681. ];
  5682. return NgbCalendarIslamicCivil;
  5683. }(NgbCalendarHijri));
  5684. /**
  5685. * @fileoverview added by tsickle
  5686. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5687. */
  5688. /**
  5689. * Umalqura calendar is one type of Hijri calendars used in islamic countries.
  5690. * This Calendar is used by Saudi Arabia for administrative purpose.
  5691. * Unlike tabular calendars, the algorithm involves astronomical calculation, but it's still deterministic.
  5692. * http://cldr.unicode.org/development/development-process/design-proposals/islamic-calendar-types
  5693. * @type {?}
  5694. */
  5695. var GREGORIAN_FIRST_DATE = new Date(1882, 10, 12);
  5696. /** @type {?} */
  5697. var GREGORIAN_LAST_DATE = new Date(2174, 10, 25);
  5698. /** @type {?} */
  5699. var HIJRI_BEGIN = 1300;
  5700. /** @type {?} */
  5701. var HIJRI_END = 1600;
  5702. /** @type {?} */
  5703. var ONE_DAY = 1000 * 60 * 60 * 24;
  5704. /** @type {?} */
  5705. var MONTH_LENGTH = [
  5706. // 1300-1304
  5707. '101010101010', '110101010100', '111011001001', '011011010100', '011011101010',
  5708. // 1305-1309
  5709. '001101101100', '101010101101', '010101010101', '011010101001', '011110010010',
  5710. // 1310-1314
  5711. '101110101001', '010111010100', '101011011010', '010101011100', '110100101101',
  5712. // 1315-1319
  5713. '011010010101', '011101001010', '101101010100', '101101101010', '010110101101',
  5714. // 1320-1324
  5715. '010010101110', '101001001111', '010100010111', '011010001011', '011010100101',
  5716. // 1325-1329
  5717. '101011010101', '001011010110', '100101011011', '010010011101', '101001001101',
  5718. // 1330-1334
  5719. '110100100110', '110110010101', '010110101100', '100110110110', '001010111010',
  5720. // 1335-1339
  5721. '101001011011', '010100101011', '101010010101', '011011001010', '101011101001',
  5722. // 1340-1344
  5723. '001011110100', '100101110110', '001010110110', '100101010110', '101011001010',
  5724. // 1345-1349
  5725. '101110100100', '101111010010', '010111011001', '001011011100', '100101101101',
  5726. // 1350-1354
  5727. '010101001101', '101010100101', '101101010010', '101110100101', '010110110100',
  5728. // 1355-1359
  5729. '100110110110', '010101010111', '001010010111', '010101001011', '011010100011',
  5730. // 1360-1364
  5731. '011101010010', '101101100101', '010101101010', '101010101011', '010100101011',
  5732. // 1365-1369
  5733. '110010010101', '110101001010', '110110100101', '010111001010', '101011010110',
  5734. // 1370-1374
  5735. '100101010111', '010010101011', '100101001011', '101010100101', '101101010010',
  5736. // 1375-1379
  5737. '101101101010', '010101110101', '001001110110', '100010110111', '010001011011',
  5738. // 1380-1384
  5739. '010101010101', '010110101001', '010110110100', '100111011010', '010011011101',
  5740. // 1385-1389
  5741. '001001101110', '100100110110', '101010101010', '110101010100', '110110110010',
  5742. // 1390-1394
  5743. '010111010101', '001011011010', '100101011011', '010010101011', '101001010101',
  5744. // 1395-1399
  5745. '101101001001', '101101100100', '101101110001', '010110110100', '101010110101',
  5746. // 1400-1404
  5747. '101001010101', '110100100101', '111010010010', '111011001001', '011011010100',
  5748. // 1405-1409
  5749. '101011101001', '100101101011', '010010101011', '101010010011', '110101001001',
  5750. // 1410-1414
  5751. '110110100100', '110110110010', '101010111001', '010010111010', '101001011011',
  5752. // 1415-1419
  5753. '010100101011', '101010010101', '101100101010', '101101010101', '010101011100',
  5754. // 1420-1424
  5755. '010010111101', '001000111101', '100100011101', '101010010101', '101101001010',
  5756. // 1425-1429
  5757. '101101011010', '010101101101', '001010110110', '100100111011', '010010011011',
  5758. // 1430-1434
  5759. '011001010101', '011010101001', '011101010100', '101101101010', '010101101100',
  5760. // 1435-1439
  5761. '101010101101', '010101010101', '101100101001', '101110010010', '101110101001',
  5762. // 1440-1444
  5763. '010111010100', '101011011010', '010101011010', '101010101011', '010110010101',
  5764. // 1445-1449
  5765. '011101001001', '011101100100', '101110101010', '010110110101', '001010110110',
  5766. // 1450-1454
  5767. '101001010110', '111001001101', '101100100101', '101101010010', '101101101010',
  5768. // 1455-1459
  5769. '010110101101', '001010101110', '100100101111', '010010010111', '011001001011',
  5770. // 1460-1464
  5771. '011010100101', '011010101100', '101011010110', '010101011101', '010010011101',
  5772. // 1465-1469
  5773. '101001001101', '110100010110', '110110010101', '010110101010', '010110110101',
  5774. // 1470-1474
  5775. '001011011010', '100101011011', '010010101101', '010110010101', '011011001010',
  5776. // 1475-1479
  5777. '011011100100', '101011101010', '010011110101', '001010110110', '100101010110',
  5778. // 1480-1484
  5779. '101010101010', '101101010100', '101111010010', '010111011001', '001011101010',
  5780. // 1485-1489
  5781. '100101101101', '010010101101', '101010010101', '101101001010', '101110100101',
  5782. // 1490-1494
  5783. '010110110010', '100110110101', '010011010110', '101010010111', '010101000111',
  5784. // 1495-1499
  5785. '011010010011', '011101001001', '101101010101', '010101101010', '101001101011',
  5786. // 1500-1504
  5787. '010100101011', '101010001011', '110101000110', '110110100011', '010111001010',
  5788. // 1505-1509
  5789. '101011010110', '010011011011', '001001101011', '100101001011', '101010100101',
  5790. // 1510-1514
  5791. '101101010010', '101101101001', '010101110101', '000101110110', '100010110111',
  5792. // 1515-1519
  5793. '001001011011', '010100101011', '010101100101', '010110110100', '100111011010',
  5794. // 1520-1524
  5795. '010011101101', '000101101101', '100010110110', '101010100110', '110101010010',
  5796. // 1525-1529
  5797. '110110101001', '010111010100', '101011011010', '100101011011', '010010101011',
  5798. // 1530-1534
  5799. '011001010011', '011100101001', '011101100010', '101110101001', '010110110010',
  5800. // 1535-1539
  5801. '101010110101', '010101010101', '101100100101', '110110010010', '111011001001',
  5802. // 1540-1544
  5803. '011011010010', '101011101001', '010101101011', '010010101011', '101001010101',
  5804. // 1545-1549
  5805. '110100101001', '110101010100', '110110101010', '100110110101', '010010111010',
  5806. // 1550-1554
  5807. '101000111011', '010010011011', '101001001101', '101010101010', '101011010101',
  5808. // 1555-1559
  5809. '001011011010', '100101011101', '010001011110', '101000101110', '110010011010',
  5810. // 1560-1564
  5811. '110101010101', '011010110010', '011010111001', '010010111010', '101001011101',
  5812. // 1565-1569
  5813. '010100101101', '101010010101', '101101010010', '101110101000', '101110110100',
  5814. // 1570-1574
  5815. '010110111001', '001011011010', '100101011010', '101101001010', '110110100100',
  5816. // 1575-1579
  5817. '111011010001', '011011101000', '101101101010', '010101101101', '010100110101',
  5818. // 1580-1584
  5819. '011010010101', '110101001010', '110110101000', '110111010100', '011011011010',
  5820. // 1585-1589
  5821. '010101011011', '001010011101', '011000101011', '101100010101', '101101001010',
  5822. // 1590-1594
  5823. '101110010101', '010110101010', '101010101110', '100100101110', '110010001111',
  5824. // 1595-1599
  5825. '010100100111', '011010010101', '011010101010', '101011010110', '010101011101',
  5826. // 1600
  5827. '001010011101'
  5828. ];
  5829. /**
  5830. * @param {?} date1
  5831. * @param {?} date2
  5832. * @return {?}
  5833. */
  5834. function getDaysDiff(date1, date2) {
  5835. // Ignores the time part in date1 and date2:
  5836. /** @type {?} */
  5837. var time1 = Date.UTC(date1.getFullYear(), date1.getMonth(), date1.getDate());
  5838. /** @type {?} */
  5839. var time2 = Date.UTC(date2.getFullYear(), date2.getMonth(), date2.getDate());
  5840. /** @type {?} */
  5841. var diff = Math.abs(time1 - time2);
  5842. return Math.round(diff / ONE_DAY);
  5843. }
  5844. var NgbCalendarIslamicUmalqura = /** @class */ (function (_super) {
  5845. __extends(NgbCalendarIslamicUmalqura, _super);
  5846. function NgbCalendarIslamicUmalqura() {
  5847. return _super !== null && _super.apply(this, arguments) || this;
  5848. }
  5849. /**
  5850. * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date.
  5851. * `gdate` is s JS Date to be converted to Hijri.
  5852. */
  5853. /**
  5854. * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date.
  5855. * `gdate` is s JS Date to be converted to Hijri.
  5856. * @param {?} gDate
  5857. * @return {?}
  5858. */
  5859. NgbCalendarIslamicUmalqura.prototype.fromGregorian = /**
  5860. * Returns the equivalent islamic(Umalqura) date value for a give input Gregorian date.
  5861. * `gdate` is s JS Date to be converted to Hijri.
  5862. * @param {?} gDate
  5863. * @return {?}
  5864. */
  5865. function (gDate) {
  5866. /** @type {?} */
  5867. var hDay = 1;
  5868. /** @type {?} */
  5869. var hMonth = 0;
  5870. /** @type {?} */
  5871. var hYear = 1300;
  5872. /** @type {?} */
  5873. var daysDiff = getDaysDiff(gDate, GREGORIAN_FIRST_DATE);
  5874. if (gDate.getTime() - GREGORIAN_FIRST_DATE.getTime() >= 0 && gDate.getTime() - GREGORIAN_LAST_DATE.getTime() <= 0) {
  5875. /** @type {?} */
  5876. var year = 1300;
  5877. for (var i = 0; i < MONTH_LENGTH.length; i++, year++) {
  5878. for (var j = 0; j < 12; j++) {
  5879. /** @type {?} */
  5880. var numOfDays = +MONTH_LENGTH[i][j] + 29;
  5881. if (daysDiff <= numOfDays) {
  5882. hDay = daysDiff + 1;
  5883. if (hDay > numOfDays) {
  5884. hDay = 1;
  5885. j++;
  5886. }
  5887. if (j > 11) {
  5888. j = 0;
  5889. year++;
  5890. }
  5891. hMonth = j;
  5892. hYear = year;
  5893. return new NgbDate(hYear, hMonth + 1, hDay);
  5894. }
  5895. daysDiff = daysDiff - numOfDays;
  5896. }
  5897. }
  5898. }
  5899. else {
  5900. return _super.prototype.fromGregorian.call(this, gDate);
  5901. }
  5902. };
  5903. /**
  5904. * Converts the current Hijri date to Gregorian.
  5905. */
  5906. /**
  5907. * Converts the current Hijri date to Gregorian.
  5908. * @param {?} hDate
  5909. * @return {?}
  5910. */
  5911. NgbCalendarIslamicUmalqura.prototype.toGregorian = /**
  5912. * Converts the current Hijri date to Gregorian.
  5913. * @param {?} hDate
  5914. * @return {?}
  5915. */
  5916. function (hDate) {
  5917. /** @type {?} */
  5918. var hYear = hDate.year;
  5919. /** @type {?} */
  5920. var hMonth = hDate.month - 1;
  5921. /** @type {?} */
  5922. var hDay = hDate.day;
  5923. /** @type {?} */
  5924. var gDate = new Date(GREGORIAN_FIRST_DATE);
  5925. /** @type {?} */
  5926. var dayDiff = hDay - 1;
  5927. if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) {
  5928. for (var y = 0; y < hYear - HIJRI_BEGIN; y++) {
  5929. for (var m = 0; m < 12; m++) {
  5930. dayDiff += +MONTH_LENGTH[y][m] + 29;
  5931. }
  5932. }
  5933. for (var m = 0; m < hMonth; m++) {
  5934. dayDiff += +MONTH_LENGTH[hYear - HIJRI_BEGIN][m] + 29;
  5935. }
  5936. gDate.setDate(GREGORIAN_FIRST_DATE.getDate() + dayDiff);
  5937. }
  5938. else {
  5939. gDate = _super.prototype.toGregorian.call(this, hDate);
  5940. }
  5941. return gDate;
  5942. };
  5943. /**
  5944. * Returns the number of days in a specific Hijri hMonth.
  5945. * `hMonth` is 1 for Muharram, 2 for Safar, etc.
  5946. * `hYear` is any Hijri hYear.
  5947. */
  5948. /**
  5949. * Returns the number of days in a specific Hijri hMonth.
  5950. * `hMonth` is 1 for Muharram, 2 for Safar, etc.
  5951. * `hYear` is any Hijri hYear.
  5952. * @param {?} hMonth
  5953. * @param {?} hYear
  5954. * @return {?}
  5955. */
  5956. NgbCalendarIslamicUmalqura.prototype.getDaysPerMonth = /**
  5957. * Returns the number of days in a specific Hijri hMonth.
  5958. * `hMonth` is 1 for Muharram, 2 for Safar, etc.
  5959. * `hYear` is any Hijri hYear.
  5960. * @param {?} hMonth
  5961. * @param {?} hYear
  5962. * @return {?}
  5963. */
  5964. function (hMonth, hYear) {
  5965. if (hYear >= HIJRI_BEGIN && hYear <= HIJRI_END) {
  5966. /** @type {?} */
  5967. var pos = hYear - HIJRI_BEGIN;
  5968. return +MONTH_LENGTH[pos][hMonth - 1] + 29;
  5969. }
  5970. return _super.prototype.getDaysPerMonth.call(this, hMonth, hYear);
  5971. };
  5972. NgbCalendarIslamicUmalqura.decorators = [
  5973. { type: core.Injectable }
  5974. ];
  5975. return NgbCalendarIslamicUmalqura;
  5976. }(NgbCalendarIslamicCivil));
  5977. /**
  5978. * @fileoverview added by tsickle
  5979. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  5980. */
  5981. /**
  5982. * Returns the equivalent JS date value for a give input Jalali date.
  5983. * `jalaliDate` is an Jalali date to be converted to Gregorian.
  5984. * @param {?} jalaliDate
  5985. * @return {?}
  5986. */
  5987. function toGregorian(jalaliDate) {
  5988. /** @type {?} */
  5989. var jdn = jalaliToJulian(jalaliDate.year, jalaliDate.month, jalaliDate.day);
  5990. /** @type {?} */
  5991. var date = julianToGregorian(jdn);
  5992. date.setHours(6, 30, 3, 200);
  5993. return date;
  5994. }
  5995. /**
  5996. * Returns the equivalent jalali date value for a give input Gregorian date.
  5997. * `gdate` is a JS Date to be converted to jalali.
  5998. * utc to local
  5999. * @param {?} gdate
  6000. * @return {?}
  6001. */
  6002. function fromGregorian(gdate) {
  6003. /** @type {?} */
  6004. var g2d = gregorianToJulian(gdate.getFullYear(), gdate.getMonth() + 1, gdate.getDate());
  6005. return julianToJalali(g2d);
  6006. }
  6007. /**
  6008. * @param {?} date
  6009. * @param {?} yearValue
  6010. * @return {?}
  6011. */
  6012. function setJalaliYear(date, yearValue) {
  6013. date.year = +yearValue;
  6014. return date;
  6015. }
  6016. /**
  6017. * @param {?} date
  6018. * @param {?} month
  6019. * @return {?}
  6020. */
  6021. function setJalaliMonth(date, month) {
  6022. month = +month;
  6023. date.year = date.year + Math.floor((month - 1) / 12);
  6024. date.month = Math.floor(((month - 1) % 12 + 12) % 12) + 1;
  6025. return date;
  6026. }
  6027. /**
  6028. * @param {?} date
  6029. * @param {?} day
  6030. * @return {?}
  6031. */
  6032. function setJalaliDay(date, day) {
  6033. /** @type {?} */
  6034. var mDays = getDaysPerMonth(date.month, date.year);
  6035. if (day <= 0) {
  6036. while (day <= 0) {
  6037. date = setJalaliMonth(date, date.month - 1);
  6038. mDays = getDaysPerMonth(date.month, date.year);
  6039. day += mDays;
  6040. }
  6041. }
  6042. else if (day > mDays) {
  6043. while (day > mDays) {
  6044. day -= mDays;
  6045. date = setJalaliMonth(date, date.month + 1);
  6046. mDays = getDaysPerMonth(date.month, date.year);
  6047. }
  6048. }
  6049. date.day = day;
  6050. return date;
  6051. }
  6052. /**
  6053. * @param {?} a
  6054. * @param {?} b
  6055. * @return {?}
  6056. */
  6057. function mod$1(a, b) {
  6058. return a - b * Math.floor(a / b);
  6059. }
  6060. /**
  6061. * @param {?} a
  6062. * @param {?} b
  6063. * @return {?}
  6064. */
  6065. function div(a, b) {
  6066. return Math.trunc(a / b);
  6067. }
  6068. /*
  6069. This function determines if the Jalali (Persian) year is
  6070. leap (366-day long) or is the common year (365 days), and
  6071. finds the day in March (Gregorian calendar) of the first
  6072. day of the Jalali year (jalaliYear).
  6073. @param jalaliYear Jalali calendar year (-61 to 3177)
  6074. @return
  6075. leap: number of years since the last leap year (0 to 4)
  6076. gYear: Gregorian year of the beginning of Jalali year
  6077. march: the March day of Farvardin the 1st (1st day of jalaliYear)
  6078. @see: http://www.astro.uni.torun.pl/~kb/Papers/EMP/PersianC-EMP.htm
  6079. @see: http://www.fourmilab.ch/documents/calendar/
  6080. */
  6081. /**
  6082. * @param {?} jalaliYear
  6083. * @return {?}
  6084. */
  6085. function jalCal(jalaliYear) {
  6086. // Jalali years starting the 33-year rule.
  6087. /** @type {?} */
  6088. var breaks = [-61, 9, 38, 199, 426, 686, 756, 818, 1111, 1181, 1210, 1635, 2060, 2097, 2192, 2262, 2324, 2394, 2456, 3178];
  6089. /** @type {?} */
  6090. var breaksLength = breaks.length;
  6091. /** @type {?} */
  6092. var gYear = jalaliYear + 621;
  6093. /** @type {?} */
  6094. var leapJ = -14;
  6095. /** @type {?} */
  6096. var jp = breaks[0];
  6097. if (jalaliYear < jp || jalaliYear >= breaks[breaksLength - 1]) {
  6098. throw new Error('Invalid Jalali year ' + jalaliYear);
  6099. }
  6100. // Find the limiting years for the Jalali year jalaliYear.
  6101. /** @type {?} */
  6102. var jump;
  6103. for (var i = 1; i < breaksLength; i += 1) {
  6104. /** @type {?} */
  6105. var jm = breaks[i];
  6106. jump = jm - jp;
  6107. if (jalaliYear < jm) {
  6108. break;
  6109. }
  6110. leapJ = leapJ + div(jump, 33) * 8 + div(mod$1(jump, 33), 4);
  6111. jp = jm;
  6112. }
  6113. /** @type {?} */
  6114. var n = jalaliYear - jp;
  6115. // Find the number of leap years from AD 621 to the beginning
  6116. // of the current Jalali year in the Persian calendar.
  6117. leapJ = leapJ + div(n, 33) * 8 + div(mod$1(n, 33) + 3, 4);
  6118. if (mod$1(jump, 33) === 4 && jump - n === 4) {
  6119. leapJ += 1;
  6120. }
  6121. // And the same in the Gregorian calendar (until the year gYear).
  6122. /** @type {?} */
  6123. var leapG = div(gYear, 4) - div((div(gYear, 100) + 1) * 3, 4) - 150;
  6124. // Determine the Gregorian date of Farvardin the 1st.
  6125. /** @type {?} */
  6126. var march = 20 + leapJ - leapG;
  6127. // Find how many years have passed since the last leap year.
  6128. if (jump - n < 6) {
  6129. n = n - jump + div(jump + 4, 33) * 33;
  6130. }
  6131. /** @type {?} */
  6132. var leap = mod$1(mod$1(n + 1, 33) - 1, 4);
  6133. if (leap === -1) {
  6134. leap = 4;
  6135. }
  6136. return { leap: leap, gy: gYear, march: march };
  6137. }
  6138. /*
  6139. Calculates Gregorian and Julian calendar dates from the Julian Day number
  6140. (jdn) for the period since jdn=-34839655 (i.e. the year -100100 of both
  6141. calendars) to some millions years ahead of the present.
  6142. @param jdn Julian Day number
  6143. @return
  6144. gYear: Calendar year (years BC numbered 0, -1, -2, ...)
  6145. gMonth: Calendar month (1 to 12)
  6146. gDay: Calendar day of the month M (1 to 28/29/30/31)
  6147. */
  6148. /**
  6149. * @param {?} julianDayNumber
  6150. * @return {?}
  6151. */
  6152. function julianToGregorian(julianDayNumber) {
  6153. /** @type {?} */
  6154. var j = 4 * julianDayNumber + 139361631;
  6155. j = j + div(div(4 * julianDayNumber + 183187720, 146097) * 3, 4) * 4 - 3908;
  6156. /** @type {?} */
  6157. var i = div(mod$1(j, 1461), 4) * 5 + 308;
  6158. /** @type {?} */
  6159. var gDay = div(mod$1(i, 153), 5) + 1;
  6160. /** @type {?} */
  6161. var gMonth = mod$1(div(i, 153), 12) + 1;
  6162. /** @type {?} */
  6163. var gYear = div(j, 1461) - 100100 + div(8 - gMonth, 6);
  6164. return new Date(gYear, gMonth - 1, gDay);
  6165. }
  6166. /*
  6167. Converts a date of the Jalali calendar to the Julian Day number.
  6168. @param jy Jalali year (1 to 3100)
  6169. @param jm Jalali month (1 to 12)
  6170. @param jd Jalali day (1 to 29/31)
  6171. @return Julian Day number
  6172. */
  6173. /**
  6174. * @param {?} gy
  6175. * @param {?} gm
  6176. * @param {?} gd
  6177. * @return {?}
  6178. */
  6179. function gregorianToJulian(gy, gm, gd) {
  6180. /** @type {?} */
  6181. var d = div((gy + div(gm - 8, 6) + 100100) * 1461, 4) + div(153 * mod$1(gm + 9, 12) + 2, 5) + gd - 34840408;
  6182. d = d - div(div(gy + 100100 + div(gm - 8, 6), 100) * 3, 4) + 752;
  6183. return d;
  6184. }
  6185. /*
  6186. Converts the Julian Day number to a date in the Jalali calendar.
  6187. @param julianDayNumber Julian Day number
  6188. @return
  6189. jalaliYear: Jalali year (1 to 3100)
  6190. jalaliMonth: Jalali month (1 to 12)
  6191. jalaliDay: Jalali day (1 to 29/31)
  6192. */
  6193. /**
  6194. * @param {?} julianDayNumber
  6195. * @return {?}
  6196. */
  6197. function julianToJalali(julianDayNumber) {
  6198. /** @type {?} */
  6199. var gy = julianToGregorian(julianDayNumber).getFullYear() // Calculate Gregorian year (gy).
  6200. ;
  6201. /** @type {?} */
  6202. var jalaliYear = gy - 621;
  6203. /** @type {?} */
  6204. var r = jalCal(jalaliYear);
  6205. /** @type {?} */
  6206. var gregorianDay = gregorianToJulian(gy, 3, r.march);
  6207. /** @type {?} */
  6208. var jalaliDay;
  6209. /** @type {?} */
  6210. var jalaliMonth;
  6211. /** @type {?} */
  6212. var numberOfDays;
  6213. // Find number of days that passed since 1 Farvardin.
  6214. numberOfDays = julianDayNumber - gregorianDay;
  6215. if (numberOfDays >= 0) {
  6216. if (numberOfDays <= 185) {
  6217. // The first 6 months.
  6218. jalaliMonth = 1 + div(numberOfDays, 31);
  6219. jalaliDay = mod$1(numberOfDays, 31) + 1;
  6220. return new NgbDate(jalaliYear, jalaliMonth, jalaliDay);
  6221. }
  6222. else {
  6223. // The remaining months.
  6224. numberOfDays -= 186;
  6225. }
  6226. }
  6227. else {
  6228. // Previous Jalali year.
  6229. jalaliYear -= 1;
  6230. numberOfDays += 179;
  6231. if (r.leap === 1) {
  6232. numberOfDays += 1;
  6233. }
  6234. }
  6235. jalaliMonth = 7 + div(numberOfDays, 30);
  6236. jalaliDay = mod$1(numberOfDays, 30) + 1;
  6237. return new NgbDate(jalaliYear, jalaliMonth, jalaliDay);
  6238. }
  6239. /*
  6240. Converts a date of the Jalali calendar to the Julian Day number.
  6241. @param jYear Jalali year (1 to 3100)
  6242. @param jMonth Jalali month (1 to 12)
  6243. @param jDay Jalali day (1 to 29/31)
  6244. @return Julian Day number
  6245. */
  6246. /**
  6247. * @param {?} jYear
  6248. * @param {?} jMonth
  6249. * @param {?} jDay
  6250. * @return {?}
  6251. */
  6252. function jalaliToJulian(jYear, jMonth, jDay) {
  6253. /** @type {?} */
  6254. var r = jalCal(jYear);
  6255. return gregorianToJulian(r.gy, 3, r.march) + (jMonth - 1) * 31 - div(jMonth, 7) * (jMonth - 7) + jDay - 1;
  6256. }
  6257. /**
  6258. * Returns the number of days in a specific jalali month.
  6259. * @param {?} month
  6260. * @param {?} year
  6261. * @return {?}
  6262. */
  6263. function getDaysPerMonth(month, year) {
  6264. if (month <= 6) {
  6265. return 31;
  6266. }
  6267. if (month <= 11) {
  6268. return 30;
  6269. }
  6270. if (jalCal(year).leap === 0) {
  6271. return 30;
  6272. }
  6273. return 29;
  6274. }
  6275. /**
  6276. * @fileoverview added by tsickle
  6277. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6278. */
  6279. var NgbCalendarPersian = /** @class */ (function (_super) {
  6280. __extends(NgbCalendarPersian, _super);
  6281. function NgbCalendarPersian() {
  6282. return _super !== null && _super.apply(this, arguments) || this;
  6283. }
  6284. /**
  6285. * @return {?}
  6286. */
  6287. NgbCalendarPersian.prototype.getDaysPerWeek = /**
  6288. * @return {?}
  6289. */
  6290. function () { return 7; };
  6291. /**
  6292. * @return {?}
  6293. */
  6294. NgbCalendarPersian.prototype.getMonths = /**
  6295. * @return {?}
  6296. */
  6297. function () { return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; };
  6298. /**
  6299. * @return {?}
  6300. */
  6301. NgbCalendarPersian.prototype.getWeeksPerMonth = /**
  6302. * @return {?}
  6303. */
  6304. function () { return 6; };
  6305. /**
  6306. * @param {?} date
  6307. * @param {?=} period
  6308. * @param {?=} number
  6309. * @return {?}
  6310. */
  6311. NgbCalendarPersian.prototype.getNext = /**
  6312. * @param {?} date
  6313. * @param {?=} period
  6314. * @param {?=} number
  6315. * @return {?}
  6316. */
  6317. function (date, period, number) {
  6318. if (period === void 0) { period = 'd'; }
  6319. if (number === void 0) { number = 1; }
  6320. date = new NgbDate(date.year, date.month, date.day);
  6321. switch (period) {
  6322. case 'y':
  6323. date = setJalaliYear(date, date.year + number);
  6324. date.month = 1;
  6325. date.day = 1;
  6326. return date;
  6327. case 'm':
  6328. date = setJalaliMonth(date, date.month + number);
  6329. date.day = 1;
  6330. return date;
  6331. case 'd':
  6332. return setJalaliDay(date, date.day + number);
  6333. default:
  6334. return date;
  6335. }
  6336. };
  6337. /**
  6338. * @param {?} date
  6339. * @param {?=} period
  6340. * @param {?=} number
  6341. * @return {?}
  6342. */
  6343. NgbCalendarPersian.prototype.getPrev = /**
  6344. * @param {?} date
  6345. * @param {?=} period
  6346. * @param {?=} number
  6347. * @return {?}
  6348. */
  6349. function (date, period, number) {
  6350. if (period === void 0) { period = 'd'; }
  6351. if (number === void 0) { number = 1; }
  6352. return this.getNext(date, period, -number);
  6353. };
  6354. /**
  6355. * @param {?} date
  6356. * @return {?}
  6357. */
  6358. NgbCalendarPersian.prototype.getWeekday = /**
  6359. * @param {?} date
  6360. * @return {?}
  6361. */
  6362. function (date) {
  6363. /** @type {?} */
  6364. var day = toGregorian(date).getDay();
  6365. // in JS Date Sun=0, in ISO 8601 Sun=7
  6366. return day === 0 ? 7 : day;
  6367. };
  6368. /**
  6369. * @param {?} week
  6370. * @param {?} firstDayOfWeek
  6371. * @return {?}
  6372. */
  6373. NgbCalendarPersian.prototype.getWeekNumber = /**
  6374. * @param {?} week
  6375. * @param {?} firstDayOfWeek
  6376. * @return {?}
  6377. */
  6378. function (week, firstDayOfWeek) {
  6379. // in JS Date Sun=0, in ISO 8601 Sun=7
  6380. if (firstDayOfWeek === 7) {
  6381. firstDayOfWeek = 0;
  6382. }
  6383. /** @type {?} */
  6384. var thursdayIndex = (4 + 7 - firstDayOfWeek) % 7;
  6385. /** @type {?} */
  6386. var date = week[thursdayIndex];
  6387. /** @type {?} */
  6388. var jsDate = toGregorian(date);
  6389. jsDate.setDate(jsDate.getDate() + 4 - (jsDate.getDay() || 7)); // Thursday
  6390. // Thursday
  6391. /** @type {?} */
  6392. var time = jsDate.getTime();
  6393. /** @type {?} */
  6394. var startDate = toGregorian(new NgbDate(date.year, 1, 1));
  6395. return Math.floor(Math.round((time - startDate.getTime()) / 86400000) / 7) + 1;
  6396. };
  6397. /**
  6398. * @return {?}
  6399. */
  6400. NgbCalendarPersian.prototype.getToday = /**
  6401. * @return {?}
  6402. */
  6403. function () { return fromGregorian(new Date()); };
  6404. /**
  6405. * @param {?} date
  6406. * @return {?}
  6407. */
  6408. NgbCalendarPersian.prototype.isValid = /**
  6409. * @param {?} date
  6410. * @return {?}
  6411. */
  6412. function (date) {
  6413. return date && isInteger(date.year) && isInteger(date.month) && isInteger(date.day) &&
  6414. !isNaN(toGregorian(date).getTime());
  6415. };
  6416. NgbCalendarPersian.decorators = [
  6417. { type: core.Injectable }
  6418. ];
  6419. return NgbCalendarPersian;
  6420. }(NgbCalendar));
  6421. /**
  6422. * @fileoverview added by tsickle
  6423. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6424. */
  6425. /** @type {?} */
  6426. var PARTS_PER_HOUR = 1080;
  6427. /** @type {?} */
  6428. var PARTS_PER_DAY = 24 * PARTS_PER_HOUR;
  6429. /** @type {?} */
  6430. var PARTS_FRACTIONAL_MONTH = 12 * PARTS_PER_HOUR + 793;
  6431. /** @type {?} */
  6432. var PARTS_PER_MONTH = 29 * PARTS_PER_DAY + PARTS_FRACTIONAL_MONTH;
  6433. /** @type {?} */
  6434. var BAHARAD = 11 * PARTS_PER_HOUR + 204;
  6435. /** @type {?} */
  6436. var HEBREW_DAY_ON_JAN_1_1970 = 2092591;
  6437. /** @type {?} */
  6438. var GREGORIAN_EPOCH$1 = 1721425.5;
  6439. /**
  6440. * @param {?} year
  6441. * @return {?}
  6442. */
  6443. function isGregorianLeapYear$1(year) {
  6444. return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0;
  6445. }
  6446. /**
  6447. * @param {?} year
  6448. * @return {?}
  6449. */
  6450. function numberOfFirstDayInYear(year) {
  6451. /** @type {?} */
  6452. var monthsBeforeYear = Math.floor((235 * year - 234) / 19);
  6453. /** @type {?} */
  6454. var fractionalMonthsBeforeYear = monthsBeforeYear * PARTS_FRACTIONAL_MONTH + BAHARAD;
  6455. /** @type {?} */
  6456. var dayNumber = monthsBeforeYear * 29 + Math.floor(fractionalMonthsBeforeYear / PARTS_PER_DAY);
  6457. /** @type {?} */
  6458. var timeOfDay = fractionalMonthsBeforeYear % PARTS_PER_DAY;
  6459. /** @type {?} */
  6460. var dayOfWeek = dayNumber % 7;
  6461. if (dayOfWeek === 2 || dayOfWeek === 4 || dayOfWeek === 6) {
  6462. dayNumber++;
  6463. dayOfWeek = dayNumber % 7;
  6464. }
  6465. if (dayOfWeek === 1 && timeOfDay > 15 * PARTS_PER_HOUR + 204 && !isHebrewLeapYear(year)) {
  6466. dayNumber += 2;
  6467. }
  6468. else if (dayOfWeek === 0 && timeOfDay > 21 * PARTS_PER_HOUR + 589 && isHebrewLeapYear(year - 1)) {
  6469. dayNumber++;
  6470. }
  6471. return dayNumber;
  6472. }
  6473. /**
  6474. * @param {?} month
  6475. * @param {?} year
  6476. * @return {?}
  6477. */
  6478. function getDaysInGregorianMonth(month, year) {
  6479. /** @type {?} */
  6480. var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
  6481. if (isGregorianLeapYear$1(year)) {
  6482. days[1]++;
  6483. }
  6484. return days[month - 1];
  6485. }
  6486. /**
  6487. * @param {?} year
  6488. * @return {?}
  6489. */
  6490. function getHebrewMonths(year) {
  6491. return isHebrewLeapYear(year) ? 13 : 12;
  6492. }
  6493. /**
  6494. * Returns the number of days in a specific Hebrew year.
  6495. * `year` is any Hebrew year.
  6496. * @param {?} year
  6497. * @return {?}
  6498. */
  6499. function getDaysInHebrewYear(year) {
  6500. return numberOfFirstDayInYear(year + 1) - numberOfFirstDayInYear(year);
  6501. }
  6502. /**
  6503. * @param {?} year
  6504. * @return {?}
  6505. */
  6506. function isHebrewLeapYear(year) {
  6507. /** @type {?} */
  6508. var b = (year * 12 + 17) % 19;
  6509. return b >= ((b < 0) ? -7 : 12);
  6510. }
  6511. /**
  6512. * Returns the number of days in a specific Hebrew month.
  6513. * `month` is 1 for Nisan, 2 for Iyar etc. Note: Hebrew leap year contains 13 months.
  6514. * `year` is any Hebrew year.
  6515. * @param {?} month
  6516. * @param {?} year
  6517. * @return {?}
  6518. */
  6519. function getDaysInHebrewMonth(month, year) {
  6520. /** @type {?} */
  6521. var yearLength = numberOfFirstDayInYear(year + 1) - numberOfFirstDayInYear(year);
  6522. /** @type {?} */
  6523. var yearType = (yearLength <= 380 ? yearLength : (yearLength - 30)) - 353;
  6524. /** @type {?} */
  6525. var leapYear = isHebrewLeapYear(year);
  6526. /** @type {?} */
  6527. var daysInMonth = leapYear ? [30, 29, 29, 29, 30, 30, 29, 30, 29, 30, 29, 30, 29] :
  6528. [30, 29, 29, 29, 30, 29, 30, 29, 30, 29, 30, 29];
  6529. if (yearType > 0) {
  6530. daysInMonth[2]++; // Kislev gets an extra day in normal or complete years.
  6531. }
  6532. if (yearType > 1) {
  6533. daysInMonth[1]++; // Heshvan gets an extra day in complete years only.
  6534. }
  6535. return daysInMonth[month - 1];
  6536. }
  6537. /**
  6538. * @param {?} date
  6539. * @return {?}
  6540. */
  6541. function getDayNumberInHebrewYear(date) {
  6542. /** @type {?} */
  6543. var numberOfDay = 0;
  6544. for (var i = 1; i < date.month; i++) {
  6545. numberOfDay += getDaysInHebrewMonth(i, date.year);
  6546. }
  6547. return numberOfDay + date.day;
  6548. }
  6549. /**
  6550. * @param {?} date
  6551. * @param {?} val
  6552. * @return {?}
  6553. */
  6554. function setHebrewMonth(date, val) {
  6555. /** @type {?} */
  6556. var after = val >= 0;
  6557. if (!after) {
  6558. val = -val;
  6559. }
  6560. while (val > 0) {
  6561. if (after) {
  6562. if (val > getHebrewMonths(date.year) - date.month) {
  6563. val -= getHebrewMonths(date.year) - date.month + 1;
  6564. date.year++;
  6565. date.month = 1;
  6566. }
  6567. else {
  6568. date.month += val;
  6569. val = 0;
  6570. }
  6571. }
  6572. else {
  6573. if (val >= date.month) {
  6574. date.year--;
  6575. val -= date.month;
  6576. date.month = getHebrewMonths(date.year);
  6577. }
  6578. else {
  6579. date.month -= val;
  6580. val = 0;
  6581. }
  6582. }
  6583. }
  6584. return date;
  6585. }
  6586. /**
  6587. * @param {?} date
  6588. * @param {?} val
  6589. * @return {?}
  6590. */
  6591. function setHebrewDay(date, val) {
  6592. /** @type {?} */
  6593. var after = val >= 0;
  6594. if (!after) {
  6595. val = -val;
  6596. }
  6597. while (val > 0) {
  6598. if (after) {
  6599. if (val > getDaysInHebrewYear(date.year) - getDayNumberInHebrewYear(date)) {
  6600. val -= getDaysInHebrewYear(date.year) - getDayNumberInHebrewYear(date) + 1;
  6601. date.year++;
  6602. date.month = 1;
  6603. date.day = 1;
  6604. }
  6605. else if (val > getDaysInHebrewMonth(date.month, date.year) - date.day) {
  6606. val -= getDaysInHebrewMonth(date.month, date.year) - date.day + 1;
  6607. date.month++;
  6608. date.day = 1;
  6609. }
  6610. else {
  6611. date.day += val;
  6612. val = 0;
  6613. }
  6614. }
  6615. else {
  6616. if (val >= date.day) {
  6617. val -= date.day;
  6618. date.month--;
  6619. if (date.month === 0) {
  6620. date.year--;
  6621. date.month = getHebrewMonths(date.year);
  6622. }
  6623. date.day = getDaysInHebrewMonth(date.month, date.year);
  6624. }
  6625. else {
  6626. date.day -= val;
  6627. val = 0;
  6628. }
  6629. }
  6630. }
  6631. return date;
  6632. }
  6633. /**
  6634. * Returns the equivalent Hebrew date value for a give input Gregorian date.
  6635. * `gdate` is a JS Date to be converted to Hebrew date.
  6636. * @param {?} gdate
  6637. * @return {?}
  6638. */
  6639. function fromGregorian$1(gdate) {
  6640. /** @type {?} */
  6641. var date = new Date(gdate);
  6642. /** @type {?} */
  6643. var gYear = date.getFullYear();
  6644. /** @type {?} */
  6645. var gMonth = date.getMonth();
  6646. /** @type {?} */
  6647. var gDay = date.getDate();
  6648. /** @type {?} */
  6649. var julianDay = GREGORIAN_EPOCH$1 - 1 + 365 * (gYear - 1) + Math.floor((gYear - 1) / 4) -
  6650. Math.floor((gYear - 1) / 100) + Math.floor((gYear - 1) / 400) +
  6651. Math.floor((367 * (gMonth + 1) - 362) / 12 + (gMonth + 1 <= 2 ? 0 : isGregorianLeapYear$1(gYear) ? -1 : -2) + gDay);
  6652. julianDay = Math.floor(julianDay + 0.5);
  6653. /** @type {?} */
  6654. var daysSinceHebEpoch = julianDay - 347997;
  6655. /** @type {?} */
  6656. var monthsSinceHebEpoch = Math.floor(daysSinceHebEpoch * PARTS_PER_DAY / PARTS_PER_MONTH);
  6657. /** @type {?} */
  6658. var hYear = Math.floor((monthsSinceHebEpoch * 19 + 234) / 235) + 1;
  6659. /** @type {?} */
  6660. var firstDayOfThisYear = numberOfFirstDayInYear(hYear);
  6661. /** @type {?} */
  6662. var dayOfYear = daysSinceHebEpoch - firstDayOfThisYear;
  6663. while (dayOfYear < 1) {
  6664. hYear--;
  6665. firstDayOfThisYear = numberOfFirstDayInYear(hYear);
  6666. dayOfYear = daysSinceHebEpoch - firstDayOfThisYear;
  6667. }
  6668. /** @type {?} */
  6669. var hMonth = 1;
  6670. /** @type {?} */
  6671. var hDay = dayOfYear;
  6672. while (hDay > getDaysInHebrewMonth(hMonth, hYear)) {
  6673. hDay -= getDaysInHebrewMonth(hMonth, hYear);
  6674. hMonth++;
  6675. }
  6676. return new NgbDate(hYear, hMonth, hDay);
  6677. }
  6678. /**
  6679. * Returns the equivalent JS date value for a given Hebrew date.
  6680. * `hebrewDate` is an Hebrew date to be converted to Gregorian.
  6681. * @param {?} hebrewDate
  6682. * @return {?}
  6683. */
  6684. function toGregorian$1(hebrewDate) {
  6685. /** @type {?} */
  6686. var hYear = hebrewDate.year;
  6687. /** @type {?} */
  6688. var hMonth = hebrewDate.month;
  6689. /** @type {?} */
  6690. var hDay = hebrewDate.day;
  6691. /** @type {?} */
  6692. var days = numberOfFirstDayInYear(hYear);
  6693. for (var i = 1; i < hMonth; i++) {
  6694. days += getDaysInHebrewMonth(i, hYear);
  6695. }
  6696. days += hDay;
  6697. /** @type {?} */
  6698. var diffDays = days - HEBREW_DAY_ON_JAN_1_1970;
  6699. /** @type {?} */
  6700. var after = diffDays >= 0;
  6701. if (!after) {
  6702. diffDays = -diffDays;
  6703. }
  6704. /** @type {?} */
  6705. var gYear = 1970;
  6706. /** @type {?} */
  6707. var gMonth = 1;
  6708. /** @type {?} */
  6709. var gDay = 1;
  6710. while (diffDays > 0) {
  6711. if (after) {
  6712. if (diffDays >= (isGregorianLeapYear$1(gYear) ? 366 : 365)) {
  6713. diffDays -= isGregorianLeapYear$1(gYear) ? 366 : 365;
  6714. gYear++;
  6715. }
  6716. else if (diffDays >= getDaysInGregorianMonth(gMonth, gYear)) {
  6717. diffDays -= getDaysInGregorianMonth(gMonth, gYear);
  6718. gMonth++;
  6719. }
  6720. else {
  6721. gDay += diffDays;
  6722. diffDays = 0;
  6723. }
  6724. }
  6725. else {
  6726. if (diffDays >= (isGregorianLeapYear$1(gYear - 1) ? 366 : 365)) {
  6727. diffDays -= isGregorianLeapYear$1(gYear - 1) ? 366 : 365;
  6728. gYear--;
  6729. }
  6730. else {
  6731. if (gMonth > 1) {
  6732. gMonth--;
  6733. }
  6734. else {
  6735. gMonth = 12;
  6736. gYear--;
  6737. }
  6738. if (diffDays >= getDaysInGregorianMonth(gMonth, gYear)) {
  6739. diffDays -= getDaysInGregorianMonth(gMonth, gYear);
  6740. }
  6741. else {
  6742. gDay = getDaysInGregorianMonth(gMonth, gYear) - diffDays + 1;
  6743. diffDays = 0;
  6744. }
  6745. }
  6746. }
  6747. }
  6748. return new Date(gYear, gMonth - 1, gDay);
  6749. }
  6750. /**
  6751. * @param {?} numerals
  6752. * @return {?}
  6753. */
  6754. function hebrewNumerals(numerals) {
  6755. if (!numerals) {
  6756. return '';
  6757. }
  6758. /** @type {?} */
  6759. var hArray0_9 = ['', '\u05d0', '\u05d1', '\u05d2', '\u05d3', '\u05d4', '\u05d5', '\u05d6', '\u05d7', '\u05d8'];
  6760. /** @type {?} */
  6761. var hArray10_19 = [
  6762. '\u05d9', '\u05d9\u05d0', '\u05d9\u05d1', '\u05d9\u05d2', '\u05d9\u05d3', '\u05d8\u05d5', '\u05d8\u05d6',
  6763. '\u05d9\u05d6', '\u05d9\u05d7', '\u05d9\u05d8'
  6764. ];
  6765. /** @type {?} */
  6766. var hArray20_90 = ['', '', '\u05db', '\u05dc', '\u05de', '\u05e0', '\u05e1', '\u05e2', '\u05e4', '\u05e6'];
  6767. /** @type {?} */
  6768. var hArray100_900 = [
  6769. '', '\u05e7', '\u05e8', '\u05e9', '\u05ea', '\u05ea\u05e7', '\u05ea\u05e8', '\u05ea\u05e9', '\u05ea\u05ea',
  6770. '\u05ea\u05ea\u05e7'
  6771. ];
  6772. /** @type {?} */
  6773. var hArray1000_9000 = [
  6774. '', '\u05d0', '\u05d1', '\u05d1\u05d0', '\u05d1\u05d1', '\u05d4', '\u05d4\u05d0', '\u05d4\u05d1',
  6775. '\u05d4\u05d1\u05d0', '\u05d4\u05d1\u05d1'
  6776. ];
  6777. /** @type {?} */
  6778. var geresh = '\u05f3';
  6779. /** @type {?} */
  6780. var gershaim = '\u05f4';
  6781. /** @type {?} */
  6782. var mem = 0;
  6783. /** @type {?} */
  6784. var result = [];
  6785. /** @type {?} */
  6786. var step = 0;
  6787. while (numerals > 0) {
  6788. /** @type {?} */
  6789. var m = numerals % 10;
  6790. if (step === 0) {
  6791. mem = m;
  6792. }
  6793. else if (step === 1) {
  6794. if (m !== 1) {
  6795. result.unshift(hArray20_90[m], hArray0_9[mem]);
  6796. }
  6797. else {
  6798. result.unshift(hArray10_19[mem]);
  6799. }
  6800. }
  6801. else if (step === 2) {
  6802. result.unshift(hArray100_900[m]);
  6803. }
  6804. else {
  6805. if (m !== 5) {
  6806. result.unshift(hArray1000_9000[m], geresh, ' ');
  6807. }
  6808. break;
  6809. }
  6810. numerals = Math.floor(numerals / 10);
  6811. if (step === 0 && numerals === 0) {
  6812. result.unshift(hArray0_9[m]);
  6813. }
  6814. step++;
  6815. }
  6816. result = result.join('').split('');
  6817. if (result.length === 1) {
  6818. result.push(geresh);
  6819. }
  6820. else if (result.length > 1) {
  6821. result.splice(result.length - 1, 0, gershaim);
  6822. }
  6823. return result.join('');
  6824. }
  6825. /**
  6826. * @fileoverview added by tsickle
  6827. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  6828. */
  6829. /**
  6830. * \@since 3.2.0
  6831. */
  6832. var NgbCalendarHebrew = /** @class */ (function (_super) {
  6833. __extends(NgbCalendarHebrew, _super);
  6834. function NgbCalendarHebrew() {
  6835. return _super !== null && _super.apply(this, arguments) || this;
  6836. }
  6837. /**
  6838. * @return {?}
  6839. */
  6840. NgbCalendarHebrew.prototype.getDaysPerWeek = /**
  6841. * @return {?}
  6842. */
  6843. function () { return 7; };
  6844. /**
  6845. * @param {?=} year
  6846. * @return {?}
  6847. */
  6848. NgbCalendarHebrew.prototype.getMonths = /**
  6849. * @param {?=} year
  6850. * @return {?}
  6851. */
  6852. function (year) {
  6853. if (year && isHebrewLeapYear(year)) {
  6854. return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13];
  6855. }
  6856. else {
  6857. return [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
  6858. }
  6859. };
  6860. /**
  6861. * @return {?}
  6862. */
  6863. NgbCalendarHebrew.prototype.getWeeksPerMonth = /**
  6864. * @return {?}
  6865. */
  6866. function () { return 6; };
  6867. /**
  6868. * @param {?} date
  6869. * @return {?}
  6870. */
  6871. NgbCalendarHebrew.prototype.isValid = /**
  6872. * @param {?} date
  6873. * @return {?}
  6874. */
  6875. function (date) {
  6876. /** @type {?} */
  6877. var b = date && isNumber(date.year) && isNumber(date.month) && isNumber(date.day);
  6878. b = b && date.month > 0 && date.month <= (isHebrewLeapYear(date.year) ? 13 : 12);
  6879. b = b && date.day > 0 && date.day <= getDaysInHebrewMonth(date.month, date.year);
  6880. return b && !isNaN(toGregorian$1(date).getTime());
  6881. };
  6882. /**
  6883. * @param {?} date
  6884. * @param {?=} period
  6885. * @param {?=} number
  6886. * @return {?}
  6887. */
  6888. NgbCalendarHebrew.prototype.getNext = /**
  6889. * @param {?} date
  6890. * @param {?=} period
  6891. * @param {?=} number
  6892. * @return {?}
  6893. */
  6894. function (date, period, number) {
  6895. if (period === void 0) { period = 'd'; }
  6896. if (number === void 0) { number = 1; }
  6897. date = new NgbDate(date.year, date.month, date.day);
  6898. switch (period) {
  6899. case 'y':
  6900. date.year += number;
  6901. date.month = 1;
  6902. date.day = 1;
  6903. return date;
  6904. case 'm':
  6905. date = setHebrewMonth(date, number);
  6906. date.day = 1;
  6907. return date;
  6908. case 'd':
  6909. return setHebrewDay(date, number);
  6910. default:
  6911. return date;
  6912. }
  6913. };
  6914. /**
  6915. * @param {?} date
  6916. * @param {?=} period
  6917. * @param {?=} number
  6918. * @return {?}
  6919. */
  6920. NgbCalendarHebrew.prototype.getPrev = /**
  6921. * @param {?} date
  6922. * @param {?=} period
  6923. * @param {?=} number
  6924. * @return {?}
  6925. */
  6926. function (date, period, number) {
  6927. if (period === void 0) { period = 'd'; }
  6928. if (number === void 0) { number = 1; }
  6929. return this.getNext(date, period, -number);
  6930. };
  6931. /**
  6932. * @param {?} date
  6933. * @return {?}
  6934. */
  6935. NgbCalendarHebrew.prototype.getWeekday = /**
  6936. * @param {?} date
  6937. * @return {?}
  6938. */
  6939. function (date) {
  6940. /** @type {?} */
  6941. var day = toGregorian$1(date).getDay();
  6942. // in JS Date Sun=0, in ISO 8601 Sun=7
  6943. return day === 0 ? 7 : day;
  6944. };
  6945. /**
  6946. * @param {?} week
  6947. * @param {?} firstDayOfWeek
  6948. * @return {?}
  6949. */
  6950. NgbCalendarHebrew.prototype.getWeekNumber = /**
  6951. * @param {?} week
  6952. * @param {?} firstDayOfWeek
  6953. * @return {?}
  6954. */
  6955. function (week, firstDayOfWeek) {
  6956. /** @type {?} */
  6957. var date = week[week.length - 1];
  6958. return Math.ceil(getDayNumberInHebrewYear(date) / 7);
  6959. };
  6960. /**
  6961. * @return {?}
  6962. */
  6963. NgbCalendarHebrew.prototype.getToday = /**
  6964. * @return {?}
  6965. */
  6966. function () { return fromGregorian$1(new Date()); };
  6967. /**
  6968. * @since 3.4.0
  6969. */
  6970. /**
  6971. * \@since 3.4.0
  6972. * @param {?} date
  6973. * @return {?}
  6974. */
  6975. NgbCalendarHebrew.prototype.toGregorian = /**
  6976. * \@since 3.4.0
  6977. * @param {?} date
  6978. * @return {?}
  6979. */
  6980. function (date) { return fromJSDate(toGregorian$1(date)); };
  6981. /**
  6982. * @since 3.4.0
  6983. */
  6984. /**
  6985. * \@since 3.4.0
  6986. * @param {?} date
  6987. * @return {?}
  6988. */
  6989. NgbCalendarHebrew.prototype.fromGregorian = /**
  6990. * \@since 3.4.0
  6991. * @param {?} date
  6992. * @return {?}
  6993. */
  6994. function (date) { return fromGregorian$1(toJSDate(date)); };
  6995. NgbCalendarHebrew.decorators = [
  6996. { type: core.Injectable }
  6997. ];
  6998. return NgbCalendarHebrew;
  6999. }(NgbCalendar));
  7000. /**
  7001. * @fileoverview added by tsickle
  7002. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7003. */
  7004. /** @type {?} */
  7005. var WEEKDAYS = ['שני', 'שלישי', 'רביעי', 'חמישי', 'שישי', 'שבת', 'ראשון'];
  7006. /** @type {?} */
  7007. var MONTHS = ['תשרי', 'חשון', 'כסלו', 'טבת', 'שבט', 'אדר', 'ניסן', 'אייר', 'סיון', 'תמוז', 'אב', 'אלול'];
  7008. /** @type {?} */
  7009. var MONTHS_LEAP = ['תשרי', 'חשון', 'כסלו', 'טבת', 'שבט', 'אדר א׳', 'אדר ב׳', 'ניסן', 'אייר', 'סיון', 'תמוז', 'אב', 'אלול'];
  7010. /**
  7011. * \@since 3.2.0
  7012. */
  7013. var NgbDatepickerI18nHebrew = /** @class */ (function (_super) {
  7014. __extends(NgbDatepickerI18nHebrew, _super);
  7015. function NgbDatepickerI18nHebrew() {
  7016. return _super !== null && _super.apply(this, arguments) || this;
  7017. }
  7018. /**
  7019. * @param {?} month
  7020. * @param {?=} year
  7021. * @return {?}
  7022. */
  7023. NgbDatepickerI18nHebrew.prototype.getMonthShortName = /**
  7024. * @param {?} month
  7025. * @param {?=} year
  7026. * @return {?}
  7027. */
  7028. function (month, year) { return this.getMonthFullName(month, year); };
  7029. /**
  7030. * @param {?} month
  7031. * @param {?=} year
  7032. * @return {?}
  7033. */
  7034. NgbDatepickerI18nHebrew.prototype.getMonthFullName = /**
  7035. * @param {?} month
  7036. * @param {?=} year
  7037. * @return {?}
  7038. */
  7039. function (month, year) {
  7040. return isHebrewLeapYear(year) ? MONTHS_LEAP[month - 1] : MONTHS[month - 1];
  7041. };
  7042. /**
  7043. * @param {?} weekday
  7044. * @return {?}
  7045. */
  7046. NgbDatepickerI18nHebrew.prototype.getWeekdayShortName = /**
  7047. * @param {?} weekday
  7048. * @return {?}
  7049. */
  7050. function (weekday) { return WEEKDAYS[weekday - 1]; };
  7051. /**
  7052. * @param {?} date
  7053. * @return {?}
  7054. */
  7055. NgbDatepickerI18nHebrew.prototype.getDayAriaLabel = /**
  7056. * @param {?} date
  7057. * @return {?}
  7058. */
  7059. function (date) {
  7060. return hebrewNumerals(date.day) + " " + this.getMonthFullName(date.month, date.year) + " " + hebrewNumerals(date.year);
  7061. };
  7062. /**
  7063. * @param {?} date
  7064. * @return {?}
  7065. */
  7066. NgbDatepickerI18nHebrew.prototype.getDayNumerals = /**
  7067. * @param {?} date
  7068. * @return {?}
  7069. */
  7070. function (date) { return hebrewNumerals(date.day); };
  7071. /**
  7072. * @param {?} weekNumber
  7073. * @return {?}
  7074. */
  7075. NgbDatepickerI18nHebrew.prototype.getWeekNumerals = /**
  7076. * @param {?} weekNumber
  7077. * @return {?}
  7078. */
  7079. function (weekNumber) { return hebrewNumerals(weekNumber); };
  7080. /**
  7081. * @param {?} year
  7082. * @return {?}
  7083. */
  7084. NgbDatepickerI18nHebrew.prototype.getYearNumerals = /**
  7085. * @param {?} year
  7086. * @return {?}
  7087. */
  7088. function (year) { return hebrewNumerals(year); };
  7089. NgbDatepickerI18nHebrew.decorators = [
  7090. { type: core.Injectable }
  7091. ];
  7092. return NgbDatepickerI18nHebrew;
  7093. }(NgbDatepickerI18n));
  7094. /**
  7095. * @fileoverview added by tsickle
  7096. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7097. */
  7098. /**
  7099. * [`NgbDateAdapter`](#/components/datepicker/api#NgbDateAdapter) implementation that uses
  7100. * native javascript dates as a user date model.
  7101. */
  7102. var NgbDateNativeAdapter = /** @class */ (function (_super) {
  7103. __extends(NgbDateNativeAdapter, _super);
  7104. function NgbDateNativeAdapter() {
  7105. return _super !== null && _super.apply(this, arguments) || this;
  7106. }
  7107. /**
  7108. * Converts a native `Date` to a `NgbDateStruct`.
  7109. */
  7110. /**
  7111. * Converts a native `Date` to a `NgbDateStruct`.
  7112. * @param {?} date
  7113. * @return {?}
  7114. */
  7115. NgbDateNativeAdapter.prototype.fromModel = /**
  7116. * Converts a native `Date` to a `NgbDateStruct`.
  7117. * @param {?} date
  7118. * @return {?}
  7119. */
  7120. function (date) {
  7121. return (date instanceof Date && !isNaN(date.getTime())) ? this._fromNativeDate(date) : null;
  7122. };
  7123. /**
  7124. * Converts a `NgbDateStruct` to a native `Date`.
  7125. */
  7126. /**
  7127. * Converts a `NgbDateStruct` to a native `Date`.
  7128. * @param {?} date
  7129. * @return {?}
  7130. */
  7131. NgbDateNativeAdapter.prototype.toModel = /**
  7132. * Converts a `NgbDateStruct` to a native `Date`.
  7133. * @param {?} date
  7134. * @return {?}
  7135. */
  7136. function (date) {
  7137. return date && isInteger(date.year) && isInteger(date.month) && isInteger(date.day) ? this._toNativeDate(date) :
  7138. null;
  7139. };
  7140. /**
  7141. * @protected
  7142. * @param {?} date
  7143. * @return {?}
  7144. */
  7145. NgbDateNativeAdapter.prototype._fromNativeDate = /**
  7146. * @protected
  7147. * @param {?} date
  7148. * @return {?}
  7149. */
  7150. function (date) {
  7151. return { year: date.getFullYear(), month: date.getMonth() + 1, day: date.getDate() };
  7152. };
  7153. /**
  7154. * @protected
  7155. * @param {?} date
  7156. * @return {?}
  7157. */
  7158. NgbDateNativeAdapter.prototype._toNativeDate = /**
  7159. * @protected
  7160. * @param {?} date
  7161. * @return {?}
  7162. */
  7163. function (date) {
  7164. /** @type {?} */
  7165. var jsDate = new Date(date.year, date.month - 1, date.day, 12);
  7166. // avoid 30 -> 1930 conversion
  7167. jsDate.setFullYear(date.year);
  7168. return jsDate;
  7169. };
  7170. NgbDateNativeAdapter.decorators = [
  7171. { type: core.Injectable }
  7172. ];
  7173. return NgbDateNativeAdapter;
  7174. }(NgbDateAdapter));
  7175. /**
  7176. * @fileoverview added by tsickle
  7177. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7178. */
  7179. /**
  7180. * Same as [`NgbDateNativeAdapter`](#/components/datepicker/api#NgbDateNativeAdapter), but with UTC dates.
  7181. *
  7182. * \@since 3.2.0
  7183. */
  7184. var NgbDateNativeUTCAdapter = /** @class */ (function (_super) {
  7185. __extends(NgbDateNativeUTCAdapter, _super);
  7186. function NgbDateNativeUTCAdapter() {
  7187. return _super !== null && _super.apply(this, arguments) || this;
  7188. }
  7189. /**
  7190. * @protected
  7191. * @param {?} date
  7192. * @return {?}
  7193. */
  7194. NgbDateNativeUTCAdapter.prototype._fromNativeDate = /**
  7195. * @protected
  7196. * @param {?} date
  7197. * @return {?}
  7198. */
  7199. function (date) {
  7200. return { year: date.getUTCFullYear(), month: date.getUTCMonth() + 1, day: date.getUTCDate() };
  7201. };
  7202. /**
  7203. * @protected
  7204. * @param {?} date
  7205. * @return {?}
  7206. */
  7207. NgbDateNativeUTCAdapter.prototype._toNativeDate = /**
  7208. * @protected
  7209. * @param {?} date
  7210. * @return {?}
  7211. */
  7212. function (date) {
  7213. /** @type {?} */
  7214. var jsDate = new Date(Date.UTC(date.year, date.month - 1, date.day));
  7215. // avoid 30 -> 1930 conversion
  7216. jsDate.setUTCFullYear(date.year);
  7217. return jsDate;
  7218. };
  7219. NgbDateNativeUTCAdapter.decorators = [
  7220. { type: core.Injectable }
  7221. ];
  7222. return NgbDateNativeUTCAdapter;
  7223. }(NgbDateNativeAdapter));
  7224. /**
  7225. * @fileoverview added by tsickle
  7226. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7227. */
  7228. var NgbDatepickerModule = /** @class */ (function () {
  7229. function NgbDatepickerModule() {
  7230. }
  7231. NgbDatepickerModule.decorators = [
  7232. { type: core.NgModule, args: [{
  7233. declarations: [
  7234. NgbDatepicker, NgbDatepickerMonthView, NgbDatepickerNavigation, NgbDatepickerNavigationSelect, NgbDatepickerDayView,
  7235. NgbInputDatepicker
  7236. ],
  7237. exports: [NgbDatepicker, NgbInputDatepicker],
  7238. imports: [common.CommonModule, forms.FormsModule],
  7239. entryComponents: [NgbDatepicker]
  7240. },] }
  7241. ];
  7242. return NgbDatepickerModule;
  7243. }());
  7244. /**
  7245. * @fileoverview added by tsickle
  7246. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7247. */
  7248. /**
  7249. * A configuration service for the [`NgbDropdown`](#/components/dropdown/api#NgbDropdown) component.
  7250. *
  7251. * You can inject this service, typically in your root component, and customize the values of its properties in
  7252. * order to provide default values for all the dropdowns used in the application.
  7253. */
  7254. var NgbDropdownConfig = /** @class */ (function () {
  7255. function NgbDropdownConfig() {
  7256. this.autoClose = true;
  7257. this.placement = ['bottom-left', 'bottom-right', 'top-left', 'top-right'];
  7258. }
  7259. NgbDropdownConfig.decorators = [
  7260. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  7261. ];
  7262. /** @nocollapse */ NgbDropdownConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbDropdownConfig_Factory() { return new NgbDropdownConfig(); }, token: NgbDropdownConfig, providedIn: "root" });
  7263. return NgbDropdownConfig;
  7264. }());
  7265. /**
  7266. * @fileoverview added by tsickle
  7267. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7268. */
  7269. var NgbNavbar = /** @class */ (function () {
  7270. function NgbNavbar() {
  7271. }
  7272. NgbNavbar.decorators = [
  7273. { type: core.Directive, args: [{ selector: '.navbar' },] }
  7274. ];
  7275. return NgbNavbar;
  7276. }());
  7277. /**
  7278. * A directive you should put on a dropdown item to enable keyboard navigation.
  7279. * Arrow keys will move focus between items marked with this directive.
  7280. *
  7281. * \@since 4.1.0
  7282. */
  7283. var NgbDropdownItem = /** @class */ (function () {
  7284. function NgbDropdownItem(elementRef) {
  7285. this.elementRef = elementRef;
  7286. this._disabled = false;
  7287. }
  7288. Object.defineProperty(NgbDropdownItem.prototype, "disabled", {
  7289. get: /**
  7290. * @return {?}
  7291. */
  7292. function () { return this._disabled; },
  7293. set: /**
  7294. * @param {?} value
  7295. * @return {?}
  7296. */
  7297. function (value) {
  7298. this._disabled = (/** @type {?} */ (value)) === '' || value === true; // accept an empty attribute as true
  7299. },
  7300. enumerable: true,
  7301. configurable: true
  7302. });
  7303. NgbDropdownItem.decorators = [
  7304. { type: core.Directive, args: [{ selector: '[ngbDropdownItem]', host: { 'class': 'dropdown-item', '[class.disabled]': 'disabled' } },] }
  7305. ];
  7306. /** @nocollapse */
  7307. NgbDropdownItem.ctorParameters = function () { return [
  7308. { type: core.ElementRef }
  7309. ]; };
  7310. NgbDropdownItem.propDecorators = {
  7311. disabled: [{ type: core.Input }]
  7312. };
  7313. return NgbDropdownItem;
  7314. }());
  7315. /**
  7316. * A directive that wraps dropdown menu content and dropdown items.
  7317. */
  7318. var NgbDropdownMenu = /** @class */ (function () {
  7319. function NgbDropdownMenu(dropdown) {
  7320. this.dropdown = dropdown;
  7321. this.placement = 'bottom';
  7322. this.isOpen = false;
  7323. }
  7324. NgbDropdownMenu.decorators = [
  7325. { type: core.Directive, args: [{
  7326. selector: '[ngbDropdownMenu]',
  7327. host: {
  7328. '[class.dropdown-menu]': 'true',
  7329. '[class.show]': 'dropdown.isOpen()',
  7330. '[attr.x-placement]': 'placement',
  7331. '(keydown.ArrowUp)': 'dropdown.onKeyDown($event)',
  7332. '(keydown.ArrowDown)': 'dropdown.onKeyDown($event)',
  7333. '(keydown.Home)': 'dropdown.onKeyDown($event)',
  7334. '(keydown.End)': 'dropdown.onKeyDown($event)',
  7335. '(keydown.Enter)': 'dropdown.onKeyDown($event)',
  7336. '(keydown.Space)': 'dropdown.onKeyDown($event)'
  7337. }
  7338. },] }
  7339. ];
  7340. /** @nocollapse */
  7341. NgbDropdownMenu.ctorParameters = function () { return [
  7342. { type: undefined, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  7343. * @return {?}
  7344. */
  7345. function () { return NgbDropdown; })),] }] }
  7346. ]; };
  7347. NgbDropdownMenu.propDecorators = {
  7348. menuItems: [{ type: core.ContentChildren, args: [NgbDropdownItem,] }]
  7349. };
  7350. return NgbDropdownMenu;
  7351. }());
  7352. /**
  7353. * A directive to mark an element to which dropdown menu will be anchored.
  7354. *
  7355. * This is a simple version of the `NgbDropdownToggle` directive.
  7356. * It plays the same role, but doesn't listen to click events to toggle dropdown menu thus enabling support
  7357. * for events other than click.
  7358. *
  7359. * \@since 1.1.0
  7360. */
  7361. var NgbDropdownAnchor = /** @class */ (function () {
  7362. function NgbDropdownAnchor(dropdown, _elementRef) {
  7363. this.dropdown = dropdown;
  7364. this._elementRef = _elementRef;
  7365. this.anchorEl = _elementRef.nativeElement;
  7366. }
  7367. /**
  7368. * @return {?}
  7369. */
  7370. NgbDropdownAnchor.prototype.getNativeElement = /**
  7371. * @return {?}
  7372. */
  7373. function () { return this._elementRef.nativeElement; };
  7374. NgbDropdownAnchor.decorators = [
  7375. { type: core.Directive, args: [{
  7376. selector: '[ngbDropdownAnchor]',
  7377. host: { 'class': 'dropdown-toggle', 'aria-haspopup': 'true', '[attr.aria-expanded]': 'dropdown.isOpen()' }
  7378. },] }
  7379. ];
  7380. /** @nocollapse */
  7381. NgbDropdownAnchor.ctorParameters = function () { return [
  7382. { type: undefined, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  7383. * @return {?}
  7384. */
  7385. function () { return NgbDropdown; })),] }] },
  7386. { type: core.ElementRef }
  7387. ]; };
  7388. return NgbDropdownAnchor;
  7389. }());
  7390. /**
  7391. * A directive to mark an element that will toggle dropdown via the `click` event.
  7392. *
  7393. * You can also use `NgbDropdownAnchor` as an alternative.
  7394. */
  7395. var NgbDropdownToggle = /** @class */ (function (_super) {
  7396. __extends(NgbDropdownToggle, _super);
  7397. function NgbDropdownToggle(dropdown, elementRef) {
  7398. return _super.call(this, dropdown, elementRef) || this;
  7399. }
  7400. NgbDropdownToggle.decorators = [
  7401. { type: core.Directive, args: [{
  7402. selector: '[ngbDropdownToggle]',
  7403. host: {
  7404. 'class': 'dropdown-toggle',
  7405. 'aria-haspopup': 'true',
  7406. '[attr.aria-expanded]': 'dropdown.isOpen()',
  7407. '(click)': 'dropdown.toggle()',
  7408. '(keydown.ArrowUp)': 'dropdown.onKeyDown($event)',
  7409. '(keydown.ArrowDown)': 'dropdown.onKeyDown($event)',
  7410. '(keydown.Home)': 'dropdown.onKeyDown($event)',
  7411. '(keydown.End)': 'dropdown.onKeyDown($event)'
  7412. },
  7413. providers: [{ provide: NgbDropdownAnchor, useExisting: core.forwardRef((/**
  7414. * @return {?}
  7415. */
  7416. function () { return NgbDropdownToggle; })) }]
  7417. },] }
  7418. ];
  7419. /** @nocollapse */
  7420. NgbDropdownToggle.ctorParameters = function () { return [
  7421. { type: undefined, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  7422. * @return {?}
  7423. */
  7424. function () { return NgbDropdown; })),] }] },
  7425. { type: core.ElementRef }
  7426. ]; };
  7427. return NgbDropdownToggle;
  7428. }(NgbDropdownAnchor));
  7429. /**
  7430. * A directive that provides contextual overlays for displaying lists of links and more.
  7431. */
  7432. var NgbDropdown = /** @class */ (function () {
  7433. function NgbDropdown(_changeDetector, config, _document, _ngZone, _elementRef, _renderer, ngbNavbar) {
  7434. var _this = this;
  7435. this._changeDetector = _changeDetector;
  7436. this._document = _document;
  7437. this._ngZone = _ngZone;
  7438. this._elementRef = _elementRef;
  7439. this._renderer = _renderer;
  7440. this._closed$ = new rxjs.Subject();
  7441. /**
  7442. * Defines whether or not the dropdown menu is opened initially.
  7443. */
  7444. this._open = false;
  7445. /**
  7446. * An event fired when the dropdown is opened or closed.
  7447. *
  7448. * The event payload is a `boolean`:
  7449. * * `true` - the dropdown was opened
  7450. * * `false` - the dropdown was closed
  7451. */
  7452. this.openChange = new core.EventEmitter();
  7453. this.placement = config.placement;
  7454. this.container = config.container;
  7455. this.autoClose = config.autoClose;
  7456. this.display = ngbNavbar ? 'static' : 'dynamic';
  7457. this._zoneSubscription = _ngZone.onStable.subscribe((/**
  7458. * @return {?}
  7459. */
  7460. function () { _this._positionMenu(); }));
  7461. }
  7462. /**
  7463. * @return {?}
  7464. */
  7465. NgbDropdown.prototype.ngAfterContentInit = /**
  7466. * @return {?}
  7467. */
  7468. function () {
  7469. var _this = this;
  7470. this._ngZone.onStable.pipe(operators.take(1)).subscribe((/**
  7471. * @return {?}
  7472. */
  7473. function () {
  7474. _this._applyPlacementClasses();
  7475. if (_this._open) {
  7476. _this._setCloseHandlers();
  7477. }
  7478. }));
  7479. };
  7480. /**
  7481. * @param {?} changes
  7482. * @return {?}
  7483. */
  7484. NgbDropdown.prototype.ngOnChanges = /**
  7485. * @param {?} changes
  7486. * @return {?}
  7487. */
  7488. function (changes) {
  7489. if (changes.container && this._open) {
  7490. this._applyContainer(this.container);
  7491. }
  7492. if (changes.placement && !changes.placement.isFirstChange) {
  7493. this._applyPlacementClasses();
  7494. }
  7495. };
  7496. /**
  7497. * Checks if the dropdown menu is open.
  7498. */
  7499. /**
  7500. * Checks if the dropdown menu is open.
  7501. * @return {?}
  7502. */
  7503. NgbDropdown.prototype.isOpen = /**
  7504. * Checks if the dropdown menu is open.
  7505. * @return {?}
  7506. */
  7507. function () { return this._open; };
  7508. /**
  7509. * Opens the dropdown menu.
  7510. */
  7511. /**
  7512. * Opens the dropdown menu.
  7513. * @return {?}
  7514. */
  7515. NgbDropdown.prototype.open = /**
  7516. * Opens the dropdown menu.
  7517. * @return {?}
  7518. */
  7519. function () {
  7520. if (!this._open) {
  7521. this._open = true;
  7522. this._applyContainer(this.container);
  7523. this.openChange.emit(true);
  7524. this._setCloseHandlers();
  7525. }
  7526. };
  7527. /**
  7528. * @private
  7529. * @return {?}
  7530. */
  7531. NgbDropdown.prototype._setCloseHandlers = /**
  7532. * @private
  7533. * @return {?}
  7534. */
  7535. function () {
  7536. var _this = this;
  7537. /** @type {?} */
  7538. var anchor = this._anchor;
  7539. ngbAutoClose(this._ngZone, this._document, this.autoClose, (/**
  7540. * @return {?}
  7541. */
  7542. function () { return _this.close(); }), this._closed$, this._menu ? [this._menuElement.nativeElement] : [], anchor ? [anchor.getNativeElement()] : [], '.dropdown-item,.dropdown-divider');
  7543. };
  7544. /**
  7545. * Closes the dropdown menu.
  7546. */
  7547. /**
  7548. * Closes the dropdown menu.
  7549. * @return {?}
  7550. */
  7551. NgbDropdown.prototype.close = /**
  7552. * Closes the dropdown menu.
  7553. * @return {?}
  7554. */
  7555. function () {
  7556. if (this._open) {
  7557. this._open = false;
  7558. this._resetContainer();
  7559. this._closed$.next();
  7560. this.openChange.emit(false);
  7561. this._changeDetector.markForCheck();
  7562. }
  7563. };
  7564. /**
  7565. * Toggles the dropdown menu.
  7566. */
  7567. /**
  7568. * Toggles the dropdown menu.
  7569. * @return {?}
  7570. */
  7571. NgbDropdown.prototype.toggle = /**
  7572. * Toggles the dropdown menu.
  7573. * @return {?}
  7574. */
  7575. function () {
  7576. if (this.isOpen()) {
  7577. this.close();
  7578. }
  7579. else {
  7580. this.open();
  7581. }
  7582. };
  7583. /**
  7584. * @return {?}
  7585. */
  7586. NgbDropdown.prototype.ngOnDestroy = /**
  7587. * @return {?}
  7588. */
  7589. function () {
  7590. this._resetContainer();
  7591. this._closed$.next();
  7592. this._zoneSubscription.unsubscribe();
  7593. };
  7594. /**
  7595. * @param {?} event
  7596. * @return {?}
  7597. */
  7598. NgbDropdown.prototype.onKeyDown = /**
  7599. * @param {?} event
  7600. * @return {?}
  7601. */
  7602. function (event) {
  7603. var _this = this;
  7604. // tslint:disable-next-line:deprecation
  7605. /** @type {?} */
  7606. var key = event.which;
  7607. /** @type {?} */
  7608. var itemElements = this._getMenuElements();
  7609. /** @type {?} */
  7610. var position = -1;
  7611. /** @type {?} */
  7612. var isEventFromItems = false;
  7613. /** @type {?} */
  7614. var itemElement = null;
  7615. /** @type {?} */
  7616. var isEventFromToggle = this._isEventFromToggle(event);
  7617. if (!isEventFromToggle && itemElements.length) {
  7618. itemElements.forEach((/**
  7619. * @param {?} item
  7620. * @param {?} index
  7621. * @return {?}
  7622. */
  7623. function (item, index) {
  7624. if (item.contains((/** @type {?} */ (event.target)))) {
  7625. isEventFromItems = true;
  7626. itemElement = item;
  7627. }
  7628. if (item === _this._document.activeElement) {
  7629. position = index;
  7630. }
  7631. }));
  7632. }
  7633. // closing on Enter / Space
  7634. if (key === Key.Space || key === Key.Enter) {
  7635. if (isEventFromItems && (this.autoClose === true || this.autoClose === 'inside')) {
  7636. // Item is either a button or a link, so click will be triggered by the browser on Enter or Space.
  7637. // So we have to register a one-time click handler that will fire after any user defined click handlers
  7638. // to close the dropdown
  7639. rxjs.fromEvent(itemElement, 'click').pipe(operators.take(1)).subscribe((/**
  7640. * @return {?}
  7641. */
  7642. function () { return _this.close(); }));
  7643. }
  7644. return;
  7645. }
  7646. // opening / navigating
  7647. if (isEventFromToggle || isEventFromItems) {
  7648. this.open();
  7649. if (itemElements.length) {
  7650. switch (key) {
  7651. case Key.ArrowDown:
  7652. position = Math.min(position + 1, itemElements.length - 1);
  7653. break;
  7654. case Key.ArrowUp:
  7655. if (this._isDropup() && position === -1) {
  7656. position = itemElements.length - 1;
  7657. break;
  7658. }
  7659. position = Math.max(position - 1, 0);
  7660. break;
  7661. case Key.Home:
  7662. position = 0;
  7663. break;
  7664. case Key.End:
  7665. position = itemElements.length - 1;
  7666. break;
  7667. }
  7668. itemElements[position].focus();
  7669. }
  7670. event.preventDefault();
  7671. }
  7672. };
  7673. /**
  7674. * @private
  7675. * @return {?}
  7676. */
  7677. NgbDropdown.prototype._isDropup = /**
  7678. * @private
  7679. * @return {?}
  7680. */
  7681. function () { return this._elementRef.nativeElement.classList.contains('dropup'); };
  7682. /**
  7683. * @private
  7684. * @param {?} event
  7685. * @return {?}
  7686. */
  7687. NgbDropdown.prototype._isEventFromToggle = /**
  7688. * @private
  7689. * @param {?} event
  7690. * @return {?}
  7691. */
  7692. function (event) {
  7693. return this._anchor.getNativeElement().contains((/** @type {?} */ (event.target)));
  7694. };
  7695. /**
  7696. * @private
  7697. * @return {?}
  7698. */
  7699. NgbDropdown.prototype._getMenuElements = /**
  7700. * @private
  7701. * @return {?}
  7702. */
  7703. function () {
  7704. /** @type {?} */
  7705. var menu = this._menu;
  7706. if (menu == null) {
  7707. return [];
  7708. }
  7709. return menu.menuItems.filter((/**
  7710. * @param {?} item
  7711. * @return {?}
  7712. */
  7713. function (item) { return !item.disabled; })).map((/**
  7714. * @param {?} item
  7715. * @return {?}
  7716. */
  7717. function (item) { return item.elementRef.nativeElement; }));
  7718. };
  7719. /**
  7720. * @private
  7721. * @return {?}
  7722. */
  7723. NgbDropdown.prototype._positionMenu = /**
  7724. * @private
  7725. * @return {?}
  7726. */
  7727. function () {
  7728. /** @type {?} */
  7729. var menu = this._menu;
  7730. if (this.isOpen() && menu) {
  7731. this._applyPlacementClasses(this.display === 'dynamic' ?
  7732. positionElements(this._anchor.anchorEl, this._bodyContainer || this._menuElement.nativeElement, this.placement, this.container === 'body') :
  7733. this._getFirstPlacement(this.placement));
  7734. }
  7735. };
  7736. /**
  7737. * @private
  7738. * @param {?} placement
  7739. * @return {?}
  7740. */
  7741. NgbDropdown.prototype._getFirstPlacement = /**
  7742. * @private
  7743. * @param {?} placement
  7744. * @return {?}
  7745. */
  7746. function (placement) {
  7747. return Array.isArray(placement) ? placement[0] : (/** @type {?} */ (placement.split(' ')[0]));
  7748. };
  7749. /**
  7750. * @private
  7751. * @return {?}
  7752. */
  7753. NgbDropdown.prototype._resetContainer = /**
  7754. * @private
  7755. * @return {?}
  7756. */
  7757. function () {
  7758. /** @type {?} */
  7759. var renderer = this._renderer;
  7760. /** @type {?} */
  7761. var menuElement = this._menuElement;
  7762. if (menuElement) {
  7763. /** @type {?} */
  7764. var dropdownElement = this._elementRef.nativeElement;
  7765. /** @type {?} */
  7766. var dropdownMenuElement = menuElement.nativeElement;
  7767. renderer.appendChild(dropdownElement, dropdownMenuElement);
  7768. renderer.removeStyle(dropdownMenuElement, 'position');
  7769. renderer.removeStyle(dropdownMenuElement, 'transform');
  7770. }
  7771. if (this._bodyContainer) {
  7772. renderer.removeChild(this._document.body, this._bodyContainer);
  7773. this._bodyContainer = null;
  7774. }
  7775. };
  7776. /**
  7777. * @private
  7778. * @param {?=} container
  7779. * @return {?}
  7780. */
  7781. NgbDropdown.prototype._applyContainer = /**
  7782. * @private
  7783. * @param {?=} container
  7784. * @return {?}
  7785. */
  7786. function (container) {
  7787. if (container === void 0) { container = null; }
  7788. this._resetContainer();
  7789. if (container === 'body') {
  7790. /** @type {?} */
  7791. var renderer = this._renderer;
  7792. /** @type {?} */
  7793. var dropdownMenuElement = this._menuElement.nativeElement;
  7794. /** @type {?} */
  7795. var bodyContainer = this._bodyContainer = this._bodyContainer || renderer.createElement('div');
  7796. // Override some styles to have the positionning working
  7797. renderer.setStyle(bodyContainer, 'position', 'absolute');
  7798. renderer.setStyle(dropdownMenuElement, 'position', 'static');
  7799. renderer.setStyle(bodyContainer, 'z-index', '1050');
  7800. renderer.appendChild(bodyContainer, dropdownMenuElement);
  7801. renderer.appendChild(this._document.body, bodyContainer);
  7802. }
  7803. };
  7804. /**
  7805. * @private
  7806. * @param {?=} placement
  7807. * @return {?}
  7808. */
  7809. NgbDropdown.prototype._applyPlacementClasses = /**
  7810. * @private
  7811. * @param {?=} placement
  7812. * @return {?}
  7813. */
  7814. function (placement) {
  7815. /** @type {?} */
  7816. var menu = this._menu;
  7817. if (menu) {
  7818. if (!placement) {
  7819. placement = this._getFirstPlacement(this.placement);
  7820. }
  7821. /** @type {?} */
  7822. var renderer = this._renderer;
  7823. /** @type {?} */
  7824. var dropdownElement = this._elementRef.nativeElement;
  7825. // remove the current placement classes
  7826. renderer.removeClass(dropdownElement, 'dropup');
  7827. renderer.removeClass(dropdownElement, 'dropdown');
  7828. menu.placement = this.display === 'static' ? null : placement;
  7829. /*
  7830. * apply the new placement
  7831. * in case of top use up-arrow or down-arrow otherwise
  7832. */
  7833. /** @type {?} */
  7834. var dropdownClass = placement.search('^top') !== -1 ? 'dropup' : 'dropdown';
  7835. renderer.addClass(dropdownElement, dropdownClass);
  7836. /** @type {?} */
  7837. var bodyContainer = this._bodyContainer;
  7838. if (bodyContainer) {
  7839. renderer.removeClass(bodyContainer, 'dropup');
  7840. renderer.removeClass(bodyContainer, 'dropdown');
  7841. renderer.addClass(bodyContainer, dropdownClass);
  7842. }
  7843. }
  7844. };
  7845. NgbDropdown.decorators = [
  7846. { type: core.Directive, args: [{ selector: '[ngbDropdown]', exportAs: 'ngbDropdown', host: { '[class.show]': 'isOpen()' } },] }
  7847. ];
  7848. /** @nocollapse */
  7849. NgbDropdown.ctorParameters = function () { return [
  7850. { type: core.ChangeDetectorRef },
  7851. { type: NgbDropdownConfig },
  7852. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  7853. { type: core.NgZone },
  7854. { type: core.ElementRef },
  7855. { type: core.Renderer2 },
  7856. { type: NgbNavbar, decorators: [{ type: core.Optional }] }
  7857. ]; };
  7858. NgbDropdown.propDecorators = {
  7859. _menu: [{ type: core.ContentChild, args: [NgbDropdownMenu, { static: false },] }],
  7860. _menuElement: [{ type: core.ContentChild, args: [NgbDropdownMenu, { read: core.ElementRef, static: false },] }],
  7861. _anchor: [{ type: core.ContentChild, args: [NgbDropdownAnchor, { static: false },] }],
  7862. autoClose: [{ type: core.Input }],
  7863. _open: [{ type: core.Input, args: ['open',] }],
  7864. placement: [{ type: core.Input }],
  7865. container: [{ type: core.Input }],
  7866. display: [{ type: core.Input }],
  7867. openChange: [{ type: core.Output }]
  7868. };
  7869. return NgbDropdown;
  7870. }());
  7871. /**
  7872. * @fileoverview added by tsickle
  7873. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7874. */
  7875. /** @type {?} */
  7876. var NGB_DROPDOWN_DIRECTIVES = [NgbDropdown, NgbDropdownAnchor, NgbDropdownToggle, NgbDropdownMenu, NgbDropdownItem, NgbNavbar];
  7877. var NgbDropdownModule = /** @class */ (function () {
  7878. function NgbDropdownModule() {
  7879. }
  7880. NgbDropdownModule.decorators = [
  7881. { type: core.NgModule, args: [{ declarations: NGB_DROPDOWN_DIRECTIVES, exports: NGB_DROPDOWN_DIRECTIVES },] }
  7882. ];
  7883. return NgbDropdownModule;
  7884. }());
  7885. /**
  7886. * @fileoverview added by tsickle
  7887. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7888. */
  7889. /**
  7890. * A configuration service for the [`NgbModal`](#/components/modal/api#NgbModal) service.
  7891. *
  7892. * You can inject this service, typically in your root component, and customize the values of its properties in
  7893. * order to provide default values for all modals used in the application.
  7894. *
  7895. * \@since 3.1.0
  7896. */
  7897. var NgbModalConfig = /** @class */ (function () {
  7898. function NgbModalConfig() {
  7899. this.backdrop = true;
  7900. this.keyboard = true;
  7901. }
  7902. NgbModalConfig.decorators = [
  7903. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  7904. ];
  7905. /** @nocollapse */ NgbModalConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbModalConfig_Factory() { return new NgbModalConfig(); }, token: NgbModalConfig, providedIn: "root" });
  7906. return NgbModalConfig;
  7907. }());
  7908. /**
  7909. * @fileoverview added by tsickle
  7910. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  7911. */
  7912. var ContentRef = /** @class */ (function () {
  7913. function ContentRef(nodes, viewRef, componentRef) {
  7914. this.nodes = nodes;
  7915. this.viewRef = viewRef;
  7916. this.componentRef = componentRef;
  7917. }
  7918. return ContentRef;
  7919. }());
  7920. /**
  7921. * @template T
  7922. */
  7923. var /**
  7924. * @template T
  7925. */
  7926. PopupService = /** @class */ (function () {
  7927. function PopupService(_type, _injector, _viewContainerRef, _renderer, _componentFactoryResolver, _applicationRef) {
  7928. this._type = _type;
  7929. this._injector = _injector;
  7930. this._viewContainerRef = _viewContainerRef;
  7931. this._renderer = _renderer;
  7932. this._componentFactoryResolver = _componentFactoryResolver;
  7933. this._applicationRef = _applicationRef;
  7934. }
  7935. /**
  7936. * @param {?=} content
  7937. * @param {?=} context
  7938. * @return {?}
  7939. */
  7940. PopupService.prototype.open = /**
  7941. * @param {?=} content
  7942. * @param {?=} context
  7943. * @return {?}
  7944. */
  7945. function (content, context) {
  7946. if (!this._windowRef) {
  7947. this._contentRef = this._getContentRef(content, context);
  7948. this._windowRef = this._viewContainerRef.createComponent(this._componentFactoryResolver.resolveComponentFactory(this._type), 0, this._injector, this._contentRef.nodes);
  7949. }
  7950. return this._windowRef;
  7951. };
  7952. /**
  7953. * @return {?}
  7954. */
  7955. PopupService.prototype.close = /**
  7956. * @return {?}
  7957. */
  7958. function () {
  7959. if (this._windowRef) {
  7960. this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._windowRef.hostView));
  7961. this._windowRef = null;
  7962. if (this._contentRef.viewRef) {
  7963. this._applicationRef.detachView(this._contentRef.viewRef);
  7964. this._contentRef.viewRef.destroy();
  7965. this._contentRef = null;
  7966. }
  7967. }
  7968. };
  7969. /**
  7970. * @private
  7971. * @param {?} content
  7972. * @param {?=} context
  7973. * @return {?}
  7974. */
  7975. PopupService.prototype._getContentRef = /**
  7976. * @private
  7977. * @param {?} content
  7978. * @param {?=} context
  7979. * @return {?}
  7980. */
  7981. function (content, context) {
  7982. if (!content) {
  7983. return new ContentRef([]);
  7984. }
  7985. else if (content instanceof core.TemplateRef) {
  7986. /** @type {?} */
  7987. var viewRef = content.createEmbeddedView(context);
  7988. this._applicationRef.attachView(viewRef);
  7989. return new ContentRef([viewRef.rootNodes], viewRef);
  7990. }
  7991. else {
  7992. return new ContentRef([[this._renderer.createText("" + content)]]);
  7993. }
  7994. };
  7995. return PopupService;
  7996. }());
  7997. /**
  7998. * @fileoverview added by tsickle
  7999. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8000. */
  8001. /** @type {?} */
  8002. var noop = (/**
  8003. * @return {?}
  8004. */
  8005. function () { });
  8006. /**
  8007. * Utility to handle the scrollbar.
  8008. *
  8009. * It allows to compensate the lack of a vertical scrollbar by adding an
  8010. * equivalent padding on the right of the body, and to remove this compensation.
  8011. */
  8012. var ScrollBar = /** @class */ (function () {
  8013. function ScrollBar(_document) {
  8014. this._document = _document;
  8015. }
  8016. /**
  8017. * To be called right before a potential vertical scrollbar would be removed:
  8018. *
  8019. * - if there was a scrollbar, adds some compensation padding to the body
  8020. * to keep the same layout as when the scrollbar is there
  8021. * - if there was none, there is nothing to do
  8022. *
  8023. * @return a callback used to revert the compensation (noop if there was none,
  8024. * otherwise a function removing the padding)
  8025. */
  8026. /**
  8027. * To be called right before a potential vertical scrollbar would be removed:
  8028. *
  8029. * - if there was a scrollbar, adds some compensation padding to the body
  8030. * to keep the same layout as when the scrollbar is there
  8031. * - if there was none, there is nothing to do
  8032. *
  8033. * @return {?} a callback used to revert the compensation (noop if there was none,
  8034. * otherwise a function removing the padding)
  8035. */
  8036. ScrollBar.prototype.compensate = /**
  8037. * To be called right before a potential vertical scrollbar would be removed:
  8038. *
  8039. * - if there was a scrollbar, adds some compensation padding to the body
  8040. * to keep the same layout as when the scrollbar is there
  8041. * - if there was none, there is nothing to do
  8042. *
  8043. * @return {?} a callback used to revert the compensation (noop if there was none,
  8044. * otherwise a function removing the padding)
  8045. */
  8046. function () {
  8047. /** @type {?} */
  8048. var width = this._getWidth();
  8049. return !this._isPresent(width) ? noop : this._adjustBody(width);
  8050. };
  8051. /**
  8052. * Adds a padding of the given width on the right of the body.
  8053. *
  8054. * @return a callback used to revert the padding to its previous value
  8055. */
  8056. /**
  8057. * Adds a padding of the given width on the right of the body.
  8058. *
  8059. * @private
  8060. * @param {?} scrollbarWidth
  8061. * @return {?} a callback used to revert the padding to its previous value
  8062. */
  8063. ScrollBar.prototype._adjustBody = /**
  8064. * Adds a padding of the given width on the right of the body.
  8065. *
  8066. * @private
  8067. * @param {?} scrollbarWidth
  8068. * @return {?} a callback used to revert the padding to its previous value
  8069. */
  8070. function (scrollbarWidth) {
  8071. /** @type {?} */
  8072. var body = this._document.body;
  8073. /** @type {?} */
  8074. var userSetPaddingStyle = body.style.paddingRight;
  8075. /** @type {?} */
  8076. var actualPadding = parseFloat(window.getComputedStyle(body)['padding-right']);
  8077. body.style['padding-right'] = actualPadding + scrollbarWidth + "px";
  8078. return (/**
  8079. * @return {?}
  8080. */
  8081. function () { return body.style['padding-right'] = userSetPaddingStyle; });
  8082. };
  8083. /**
  8084. * Tells whether a scrollbar is currently present on the body.
  8085. *
  8086. * @return true if scrollbar is present, false otherwise
  8087. */
  8088. /**
  8089. * Tells whether a scrollbar is currently present on the body.
  8090. *
  8091. * @private
  8092. * @param {?} scrollbarWidth
  8093. * @return {?} true if scrollbar is present, false otherwise
  8094. */
  8095. ScrollBar.prototype._isPresent = /**
  8096. * Tells whether a scrollbar is currently present on the body.
  8097. *
  8098. * @private
  8099. * @param {?} scrollbarWidth
  8100. * @return {?} true if scrollbar is present, false otherwise
  8101. */
  8102. function (scrollbarWidth) {
  8103. /** @type {?} */
  8104. var rect = this._document.body.getBoundingClientRect();
  8105. /** @type {?} */
  8106. var bodyToViewportGap = window.innerWidth - (rect.left + rect.right);
  8107. /** @type {?} */
  8108. var uncertainty = 0.1 * scrollbarWidth;
  8109. return bodyToViewportGap >= scrollbarWidth - uncertainty;
  8110. };
  8111. /**
  8112. * Calculates and returns the width of a scrollbar.
  8113. *
  8114. * @return the width of a scrollbar on this page
  8115. */
  8116. /**
  8117. * Calculates and returns the width of a scrollbar.
  8118. *
  8119. * @private
  8120. * @return {?} the width of a scrollbar on this page
  8121. */
  8122. ScrollBar.prototype._getWidth = /**
  8123. * Calculates and returns the width of a scrollbar.
  8124. *
  8125. * @private
  8126. * @return {?} the width of a scrollbar on this page
  8127. */
  8128. function () {
  8129. /** @type {?} */
  8130. var measurer = this._document.createElement('div');
  8131. measurer.className = 'modal-scrollbar-measure';
  8132. /** @type {?} */
  8133. var body = this._document.body;
  8134. body.appendChild(measurer);
  8135. /** @type {?} */
  8136. var width = measurer.getBoundingClientRect().width - measurer.clientWidth;
  8137. body.removeChild(measurer);
  8138. return width;
  8139. };
  8140. ScrollBar.decorators = [
  8141. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  8142. ];
  8143. /** @nocollapse */
  8144. ScrollBar.ctorParameters = function () { return [
  8145. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] }
  8146. ]; };
  8147. /** @nocollapse */ ScrollBar.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function ScrollBar_Factory() { return new ScrollBar(core.ɵɵinject(common.DOCUMENT)); }, token: ScrollBar, providedIn: "root" });
  8148. return ScrollBar;
  8149. }());
  8150. /**
  8151. * @fileoverview added by tsickle
  8152. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8153. */
  8154. var NgbModalBackdrop = /** @class */ (function () {
  8155. function NgbModalBackdrop() {
  8156. }
  8157. NgbModalBackdrop.decorators = [
  8158. { type: core.Component, args: [{
  8159. selector: 'ngb-modal-backdrop',
  8160. encapsulation: core.ViewEncapsulation.None,
  8161. template: '',
  8162. host: { '[class]': '"modal-backdrop fade show" + (backdropClass ? " " + backdropClass : "")', 'style': 'z-index: 1050' }
  8163. }] }
  8164. ];
  8165. NgbModalBackdrop.propDecorators = {
  8166. backdropClass: [{ type: core.Input }]
  8167. };
  8168. return NgbModalBackdrop;
  8169. }());
  8170. /**
  8171. * @fileoverview added by tsickle
  8172. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8173. */
  8174. /**
  8175. * A reference to the currently opened (active) modal.
  8176. *
  8177. * Instances of this class can be injected into your component passed as modal content.
  8178. * So you can `.close()` or `.dismiss()` the modal window from your component.
  8179. */
  8180. var /**
  8181. * A reference to the currently opened (active) modal.
  8182. *
  8183. * Instances of this class can be injected into your component passed as modal content.
  8184. * So you can `.close()` or `.dismiss()` the modal window from your component.
  8185. */
  8186. NgbActiveModal = /** @class */ (function () {
  8187. function NgbActiveModal() {
  8188. }
  8189. /**
  8190. * Closes the modal with an optional `result` value.
  8191. *
  8192. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  8193. */
  8194. /**
  8195. * Closes the modal with an optional `result` value.
  8196. *
  8197. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  8198. * @param {?=} result
  8199. * @return {?}
  8200. */
  8201. NgbActiveModal.prototype.close = /**
  8202. * Closes the modal with an optional `result` value.
  8203. *
  8204. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  8205. * @param {?=} result
  8206. * @return {?}
  8207. */
  8208. function (result) { };
  8209. /**
  8210. * Dismisses the modal with an optional `reason` value.
  8211. *
  8212. * The `NgbModalRef.result` promise will be rejected with the provided value.
  8213. */
  8214. /**
  8215. * Dismisses the modal with an optional `reason` value.
  8216. *
  8217. * The `NgbModalRef.result` promise will be rejected with the provided value.
  8218. * @param {?=} reason
  8219. * @return {?}
  8220. */
  8221. NgbActiveModal.prototype.dismiss = /**
  8222. * Dismisses the modal with an optional `reason` value.
  8223. *
  8224. * The `NgbModalRef.result` promise will be rejected with the provided value.
  8225. * @param {?=} reason
  8226. * @return {?}
  8227. */
  8228. function (reason) { };
  8229. return NgbActiveModal;
  8230. }());
  8231. /**
  8232. * A reference to the newly opened modal returned by the `NgbModal.open()` method.
  8233. */
  8234. var /**
  8235. * A reference to the newly opened modal returned by the `NgbModal.open()` method.
  8236. */
  8237. NgbModalRef = /** @class */ (function () {
  8238. function NgbModalRef(_windowCmptRef, _contentRef, _backdropCmptRef, _beforeDismiss) {
  8239. var _this = this;
  8240. this._windowCmptRef = _windowCmptRef;
  8241. this._contentRef = _contentRef;
  8242. this._backdropCmptRef = _backdropCmptRef;
  8243. this._beforeDismiss = _beforeDismiss;
  8244. _windowCmptRef.instance.dismissEvent.subscribe((/**
  8245. * @param {?} reason
  8246. * @return {?}
  8247. */
  8248. function (reason) { _this.dismiss(reason); }));
  8249. this.result = new Promise((/**
  8250. * @param {?} resolve
  8251. * @param {?} reject
  8252. * @return {?}
  8253. */
  8254. function (resolve, reject) {
  8255. _this._resolve = resolve;
  8256. _this._reject = reject;
  8257. }));
  8258. this.result.then(null, (/**
  8259. * @return {?}
  8260. */
  8261. function () { }));
  8262. }
  8263. Object.defineProperty(NgbModalRef.prototype, "componentInstance", {
  8264. /**
  8265. * The instance of a component used for the modal content.
  8266. *
  8267. * When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`.
  8268. */
  8269. get: /**
  8270. * The instance of a component used for the modal content.
  8271. *
  8272. * When a `TemplateRef` is used as the content or when the modal is closed, will return `undefined`.
  8273. * @return {?}
  8274. */
  8275. function () {
  8276. if (this._contentRef && this._contentRef.componentRef) {
  8277. return this._contentRef.componentRef.instance;
  8278. }
  8279. },
  8280. enumerable: true,
  8281. configurable: true
  8282. });
  8283. /**
  8284. * Closes the modal with an optional `result` value.
  8285. *
  8286. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  8287. */
  8288. /**
  8289. * Closes the modal with an optional `result` value.
  8290. *
  8291. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  8292. * @param {?=} result
  8293. * @return {?}
  8294. */
  8295. NgbModalRef.prototype.close = /**
  8296. * Closes the modal with an optional `result` value.
  8297. *
  8298. * The `NgbMobalRef.result` promise will be resolved with the provided value.
  8299. * @param {?=} result
  8300. * @return {?}
  8301. */
  8302. function (result) {
  8303. if (this._windowCmptRef) {
  8304. this._resolve(result);
  8305. this._removeModalElements();
  8306. }
  8307. };
  8308. /**
  8309. * @private
  8310. * @param {?=} reason
  8311. * @return {?}
  8312. */
  8313. NgbModalRef.prototype._dismiss = /**
  8314. * @private
  8315. * @param {?=} reason
  8316. * @return {?}
  8317. */
  8318. function (reason) {
  8319. this._reject(reason);
  8320. this._removeModalElements();
  8321. };
  8322. /**
  8323. * Dismisses the modal with an optional `reason` value.
  8324. *
  8325. * The `NgbModalRef.result` promise will be rejected with the provided value.
  8326. */
  8327. /**
  8328. * Dismisses the modal with an optional `reason` value.
  8329. *
  8330. * The `NgbModalRef.result` promise will be rejected with the provided value.
  8331. * @param {?=} reason
  8332. * @return {?}
  8333. */
  8334. NgbModalRef.prototype.dismiss = /**
  8335. * Dismisses the modal with an optional `reason` value.
  8336. *
  8337. * The `NgbModalRef.result` promise will be rejected with the provided value.
  8338. * @param {?=} reason
  8339. * @return {?}
  8340. */
  8341. function (reason) {
  8342. var _this = this;
  8343. if (this._windowCmptRef) {
  8344. if (!this._beforeDismiss) {
  8345. this._dismiss(reason);
  8346. }
  8347. else {
  8348. /** @type {?} */
  8349. var dismiss = this._beforeDismiss();
  8350. if (dismiss && dismiss.then) {
  8351. dismiss.then((/**
  8352. * @param {?} result
  8353. * @return {?}
  8354. */
  8355. function (result) {
  8356. if (result !== false) {
  8357. _this._dismiss(reason);
  8358. }
  8359. }), (/**
  8360. * @return {?}
  8361. */
  8362. function () { }));
  8363. }
  8364. else if (dismiss !== false) {
  8365. this._dismiss(reason);
  8366. }
  8367. }
  8368. }
  8369. };
  8370. /**
  8371. * @private
  8372. * @return {?}
  8373. */
  8374. NgbModalRef.prototype._removeModalElements = /**
  8375. * @private
  8376. * @return {?}
  8377. */
  8378. function () {
  8379. /** @type {?} */
  8380. var windowNativeEl = this._windowCmptRef.location.nativeElement;
  8381. windowNativeEl.parentNode.removeChild(windowNativeEl);
  8382. this._windowCmptRef.destroy();
  8383. if (this._backdropCmptRef) {
  8384. /** @type {?} */
  8385. var backdropNativeEl = this._backdropCmptRef.location.nativeElement;
  8386. backdropNativeEl.parentNode.removeChild(backdropNativeEl);
  8387. this._backdropCmptRef.destroy();
  8388. }
  8389. if (this._contentRef && this._contentRef.viewRef) {
  8390. this._contentRef.viewRef.destroy();
  8391. }
  8392. this._windowCmptRef = null;
  8393. this._backdropCmptRef = null;
  8394. this._contentRef = null;
  8395. };
  8396. return NgbModalRef;
  8397. }());
  8398. /**
  8399. * @fileoverview added by tsickle
  8400. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8401. */
  8402. /** @enum {number} */
  8403. var ModalDismissReasons = {
  8404. BACKDROP_CLICK: 0,
  8405. ESC: 1,
  8406. };
  8407. ModalDismissReasons[ModalDismissReasons.BACKDROP_CLICK] = 'BACKDROP_CLICK';
  8408. ModalDismissReasons[ModalDismissReasons.ESC] = 'ESC';
  8409. /**
  8410. * @fileoverview added by tsickle
  8411. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8412. */
  8413. var NgbModalWindow = /** @class */ (function () {
  8414. function NgbModalWindow(_document, _elRef, _zone) {
  8415. this._document = _document;
  8416. this._elRef = _elRef;
  8417. this._zone = _zone;
  8418. this._closed$ = new rxjs.Subject();
  8419. this.backdrop = true;
  8420. this.keyboard = true;
  8421. this.dismissEvent = new core.EventEmitter();
  8422. }
  8423. /**
  8424. * @param {?} reason
  8425. * @return {?}
  8426. */
  8427. NgbModalWindow.prototype.dismiss = /**
  8428. * @param {?} reason
  8429. * @return {?}
  8430. */
  8431. function (reason) { this.dismissEvent.emit(reason); };
  8432. /**
  8433. * @return {?}
  8434. */
  8435. NgbModalWindow.prototype.ngOnInit = /**
  8436. * @return {?}
  8437. */
  8438. function () { this._elWithFocus = this._document.activeElement; };
  8439. /**
  8440. * @return {?}
  8441. */
  8442. NgbModalWindow.prototype.ngAfterViewInit = /**
  8443. * @return {?}
  8444. */
  8445. function () {
  8446. var _this = this;
  8447. var nativeElement = this._elRef.nativeElement;
  8448. this._zone.runOutsideAngular((/**
  8449. * @return {?}
  8450. */
  8451. function () {
  8452. rxjs.fromEvent(nativeElement, 'keydown')
  8453. .pipe(operators.takeUntil(_this._closed$),
  8454. // tslint:disable-next-line:deprecation
  8455. operators.filter((/**
  8456. * @param {?} e
  8457. * @return {?}
  8458. */
  8459. function (e) { return e.which === Key.Escape && _this.keyboard; })))
  8460. .subscribe((/**
  8461. * @param {?} event
  8462. * @return {?}
  8463. */
  8464. function (event) { return requestAnimationFrame((/**
  8465. * @return {?}
  8466. */
  8467. function () {
  8468. if (!event.defaultPrevented) {
  8469. _this._zone.run((/**
  8470. * @return {?}
  8471. */
  8472. function () { return _this.dismiss(ModalDismissReasons.ESC); }));
  8473. }
  8474. })); }));
  8475. // We're listening to 'mousedown' and 'mouseup' to prevent modal from closing when pressing the mouse
  8476. // inside the modal dialog and releasing it outside
  8477. /** @type {?} */
  8478. var preventClose = false;
  8479. rxjs.fromEvent(_this._dialogEl.nativeElement, 'mousedown')
  8480. .pipe(operators.takeUntil(_this._closed$), operators.tap((/**
  8481. * @return {?}
  8482. */
  8483. function () { return preventClose = false; })), operators.switchMap((/**
  8484. * @return {?}
  8485. */
  8486. function () { return rxjs.fromEvent(nativeElement, 'mouseup').pipe(operators.takeUntil(_this._closed$), operators.take(1)); })), operators.filter((/**
  8487. * @param {?} __0
  8488. * @return {?}
  8489. */
  8490. function (_a) {
  8491. var target = _a.target;
  8492. return nativeElement === target;
  8493. })))
  8494. .subscribe((/**
  8495. * @return {?}
  8496. */
  8497. function () { preventClose = true; }));
  8498. // We're listening to 'click' to dismiss modal on modal window click, except when:
  8499. // 1. clicking on modal dialog itself
  8500. // 2. closing was prevented by mousedown/up handlers
  8501. // 3. clicking on scrollbar when the viewport is too small and modal doesn't fit (click is not triggered at all)
  8502. rxjs.fromEvent(nativeElement, 'click').pipe(operators.takeUntil(_this._closed$)).subscribe((/**
  8503. * @param {?} __0
  8504. * @return {?}
  8505. */
  8506. function (_a) {
  8507. var target = _a.target;
  8508. if (_this.backdrop === true && nativeElement === target && !preventClose) {
  8509. _this._zone.run((/**
  8510. * @return {?}
  8511. */
  8512. function () { return _this.dismiss(ModalDismissReasons.BACKDROP_CLICK); }));
  8513. }
  8514. preventClose = false;
  8515. }));
  8516. }));
  8517. if (!nativeElement.contains(document.activeElement)) {
  8518. /** @type {?} */
  8519. var autoFocusable = (/** @type {?} */ (nativeElement.querySelector("[ngbAutofocus]")));
  8520. /** @type {?} */
  8521. var firstFocusable = getFocusableBoundaryElements(nativeElement)[0];
  8522. /** @type {?} */
  8523. var elementToFocus = autoFocusable || firstFocusable || nativeElement;
  8524. elementToFocus.focus();
  8525. }
  8526. };
  8527. /**
  8528. * @return {?}
  8529. */
  8530. NgbModalWindow.prototype.ngOnDestroy = /**
  8531. * @return {?}
  8532. */
  8533. function () {
  8534. var _this = this;
  8535. /** @type {?} */
  8536. var body = this._document.body;
  8537. /** @type {?} */
  8538. var elWithFocus = this._elWithFocus;
  8539. /** @type {?} */
  8540. var elementToFocus;
  8541. if (elWithFocus && elWithFocus['focus'] && body.contains(elWithFocus)) {
  8542. elementToFocus = elWithFocus;
  8543. }
  8544. else {
  8545. elementToFocus = body;
  8546. }
  8547. this._zone.runOutsideAngular((/**
  8548. * @return {?}
  8549. */
  8550. function () {
  8551. setTimeout((/**
  8552. * @return {?}
  8553. */
  8554. function () { return elementToFocus.focus(); }));
  8555. _this._elWithFocus = null;
  8556. }));
  8557. this._closed$.next();
  8558. };
  8559. NgbModalWindow.decorators = [
  8560. { type: core.Component, args: [{
  8561. selector: 'ngb-modal-window',
  8562. host: {
  8563. '[class]': '"modal fade show d-block" + (windowClass ? " " + windowClass : "")',
  8564. 'role': 'dialog',
  8565. 'tabindex': '-1',
  8566. '[attr.aria-modal]': 'true',
  8567. '[attr.aria-labelledby]': 'ariaLabelledBy',
  8568. },
  8569. template: "\n <div #dialog [class]=\"'modal-dialog' + (size ? ' modal-' + size : '') + (centered ? ' modal-dialog-centered' : '') +\n (scrollable ? ' modal-dialog-scrollable' : '')\" role=\"document\">\n <div class=\"modal-content\"><ng-content></ng-content></div>\n </div>\n ",
  8570. encapsulation: core.ViewEncapsulation.None,
  8571. styles: ["ngb-modal-window .component-host-scrollable{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;overflow:hidden}"]
  8572. }] }
  8573. ];
  8574. /** @nocollapse */
  8575. NgbModalWindow.ctorParameters = function () { return [
  8576. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  8577. { type: core.ElementRef },
  8578. { type: core.NgZone }
  8579. ]; };
  8580. NgbModalWindow.propDecorators = {
  8581. _dialogEl: [{ type: core.ViewChild, args: ['dialog', { static: true },] }],
  8582. ariaLabelledBy: [{ type: core.Input }],
  8583. backdrop: [{ type: core.Input }],
  8584. centered: [{ type: core.Input }],
  8585. keyboard: [{ type: core.Input }],
  8586. scrollable: [{ type: core.Input }],
  8587. size: [{ type: core.Input }],
  8588. windowClass: [{ type: core.Input }],
  8589. dismissEvent: [{ type: core.Output, args: ['dismiss',] }]
  8590. };
  8591. return NgbModalWindow;
  8592. }());
  8593. /**
  8594. * @fileoverview added by tsickle
  8595. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  8596. */
  8597. var NgbModalStack = /** @class */ (function () {
  8598. function NgbModalStack(_applicationRef, _injector, _document, _scrollBar, _rendererFactory, _ngZone) {
  8599. var _this = this;
  8600. this._applicationRef = _applicationRef;
  8601. this._injector = _injector;
  8602. this._document = _document;
  8603. this._scrollBar = _scrollBar;
  8604. this._rendererFactory = _rendererFactory;
  8605. this._ngZone = _ngZone;
  8606. this._activeWindowCmptHasChanged = new rxjs.Subject();
  8607. this._ariaHiddenValues = new Map();
  8608. this._backdropAttributes = ['backdropClass'];
  8609. this._modalRefs = [];
  8610. this._windowAttributes = ['ariaLabelledBy', 'backdrop', 'centered', 'keyboard', 'scrollable', 'size', 'windowClass'];
  8611. this._windowCmpts = [];
  8612. // Trap focus on active WindowCmpt
  8613. this._activeWindowCmptHasChanged.subscribe((/**
  8614. * @return {?}
  8615. */
  8616. function () {
  8617. if (_this._windowCmpts.length) {
  8618. /** @type {?} */
  8619. var activeWindowCmpt = _this._windowCmpts[_this._windowCmpts.length - 1];
  8620. ngbFocusTrap(_this._ngZone, activeWindowCmpt.location.nativeElement, _this._activeWindowCmptHasChanged);
  8621. _this._revertAriaHidden();
  8622. _this._setAriaHidden(activeWindowCmpt.location.nativeElement);
  8623. }
  8624. }));
  8625. }
  8626. /**
  8627. * @param {?} moduleCFR
  8628. * @param {?} contentInjector
  8629. * @param {?} content
  8630. * @param {?} options
  8631. * @return {?}
  8632. */
  8633. NgbModalStack.prototype.open = /**
  8634. * @param {?} moduleCFR
  8635. * @param {?} contentInjector
  8636. * @param {?} content
  8637. * @param {?} options
  8638. * @return {?}
  8639. */
  8640. function (moduleCFR, contentInjector, content, options) {
  8641. var _this = this;
  8642. /** @type {?} */
  8643. var containerEl = isDefined(options.container) ? this._document.querySelector(options.container) : this._document.body;
  8644. /** @type {?} */
  8645. var renderer = this._rendererFactory.createRenderer(null, null);
  8646. /** @type {?} */
  8647. var revertPaddingForScrollBar = this._scrollBar.compensate();
  8648. /** @type {?} */
  8649. var removeBodyClass = (/**
  8650. * @return {?}
  8651. */
  8652. function () {
  8653. if (!_this._modalRefs.length) {
  8654. renderer.removeClass(_this._document.body, 'modal-open');
  8655. _this._revertAriaHidden();
  8656. }
  8657. });
  8658. if (!containerEl) {
  8659. throw new Error("The specified modal container \"" + (options.container || 'body') + "\" was not found in the DOM.");
  8660. }
  8661. /** @type {?} */
  8662. var activeModal = new NgbActiveModal();
  8663. /** @type {?} */
  8664. var contentRef = this._getContentRef(moduleCFR, options.injector || contentInjector, content, activeModal, options);
  8665. /** @type {?} */
  8666. var backdropCmptRef = options.backdrop !== false ? this._attachBackdrop(moduleCFR, containerEl) : null;
  8667. /** @type {?} */
  8668. var windowCmptRef = this._attachWindowComponent(moduleCFR, containerEl, contentRef);
  8669. /** @type {?} */
  8670. var ngbModalRef = new NgbModalRef(windowCmptRef, contentRef, backdropCmptRef, options.beforeDismiss);
  8671. this._registerModalRef(ngbModalRef);
  8672. this._registerWindowCmpt(windowCmptRef);
  8673. ngbModalRef.result.then(revertPaddingForScrollBar, revertPaddingForScrollBar);
  8674. ngbModalRef.result.then(removeBodyClass, removeBodyClass);
  8675. activeModal.close = (/**
  8676. * @param {?} result
  8677. * @return {?}
  8678. */
  8679. function (result) { ngbModalRef.close(result); });
  8680. activeModal.dismiss = (/**
  8681. * @param {?} reason
  8682. * @return {?}
  8683. */
  8684. function (reason) { ngbModalRef.dismiss(reason); });
  8685. this._applyWindowOptions(windowCmptRef.instance, options);
  8686. if (this._modalRefs.length === 1) {
  8687. renderer.addClass(this._document.body, 'modal-open');
  8688. }
  8689. if (backdropCmptRef && backdropCmptRef.instance) {
  8690. this._applyBackdropOptions(backdropCmptRef.instance, options);
  8691. }
  8692. return ngbModalRef;
  8693. };
  8694. /**
  8695. * @param {?=} reason
  8696. * @return {?}
  8697. */
  8698. NgbModalStack.prototype.dismissAll = /**
  8699. * @param {?=} reason
  8700. * @return {?}
  8701. */
  8702. function (reason) { this._modalRefs.forEach((/**
  8703. * @param {?} ngbModalRef
  8704. * @return {?}
  8705. */
  8706. function (ngbModalRef) { return ngbModalRef.dismiss(reason); })); };
  8707. /**
  8708. * @return {?}
  8709. */
  8710. NgbModalStack.prototype.hasOpenModals = /**
  8711. * @return {?}
  8712. */
  8713. function () { return this._modalRefs.length > 0; };
  8714. /**
  8715. * @private
  8716. * @param {?} moduleCFR
  8717. * @param {?} containerEl
  8718. * @return {?}
  8719. */
  8720. NgbModalStack.prototype._attachBackdrop = /**
  8721. * @private
  8722. * @param {?} moduleCFR
  8723. * @param {?} containerEl
  8724. * @return {?}
  8725. */
  8726. function (moduleCFR, containerEl) {
  8727. /** @type {?} */
  8728. var backdropFactory = moduleCFR.resolveComponentFactory(NgbModalBackdrop);
  8729. /** @type {?} */
  8730. var backdropCmptRef = backdropFactory.create(this._injector);
  8731. this._applicationRef.attachView(backdropCmptRef.hostView);
  8732. containerEl.appendChild(backdropCmptRef.location.nativeElement);
  8733. return backdropCmptRef;
  8734. };
  8735. /**
  8736. * @private
  8737. * @param {?} moduleCFR
  8738. * @param {?} containerEl
  8739. * @param {?} contentRef
  8740. * @return {?}
  8741. */
  8742. NgbModalStack.prototype._attachWindowComponent = /**
  8743. * @private
  8744. * @param {?} moduleCFR
  8745. * @param {?} containerEl
  8746. * @param {?} contentRef
  8747. * @return {?}
  8748. */
  8749. function (moduleCFR, containerEl, contentRef) {
  8750. /** @type {?} */
  8751. var windowFactory = moduleCFR.resolveComponentFactory(NgbModalWindow);
  8752. /** @type {?} */
  8753. var windowCmptRef = windowFactory.create(this._injector, contentRef.nodes);
  8754. this._applicationRef.attachView(windowCmptRef.hostView);
  8755. containerEl.appendChild(windowCmptRef.location.nativeElement);
  8756. return windowCmptRef;
  8757. };
  8758. /**
  8759. * @private
  8760. * @param {?} windowInstance
  8761. * @param {?} options
  8762. * @return {?}
  8763. */
  8764. NgbModalStack.prototype._applyWindowOptions = /**
  8765. * @private
  8766. * @param {?} windowInstance
  8767. * @param {?} options
  8768. * @return {?}
  8769. */
  8770. function (windowInstance, options) {
  8771. this._windowAttributes.forEach((/**
  8772. * @param {?} optionName
  8773. * @return {?}
  8774. */
  8775. function (optionName) {
  8776. if (isDefined(options[optionName])) {
  8777. windowInstance[optionName] = options[optionName];
  8778. }
  8779. }));
  8780. };
  8781. /**
  8782. * @private
  8783. * @param {?} backdropInstance
  8784. * @param {?} options
  8785. * @return {?}
  8786. */
  8787. NgbModalStack.prototype._applyBackdropOptions = /**
  8788. * @private
  8789. * @param {?} backdropInstance
  8790. * @param {?} options
  8791. * @return {?}
  8792. */
  8793. function (backdropInstance, options) {
  8794. this._backdropAttributes.forEach((/**
  8795. * @param {?} optionName
  8796. * @return {?}
  8797. */
  8798. function (optionName) {
  8799. if (isDefined(options[optionName])) {
  8800. backdropInstance[optionName] = options[optionName];
  8801. }
  8802. }));
  8803. };
  8804. /**
  8805. * @private
  8806. * @param {?} moduleCFR
  8807. * @param {?} contentInjector
  8808. * @param {?} content
  8809. * @param {?} activeModal
  8810. * @param {?} options
  8811. * @return {?}
  8812. */
  8813. NgbModalStack.prototype._getContentRef = /**
  8814. * @private
  8815. * @param {?} moduleCFR
  8816. * @param {?} contentInjector
  8817. * @param {?} content
  8818. * @param {?} activeModal
  8819. * @param {?} options
  8820. * @return {?}
  8821. */
  8822. function (moduleCFR, contentInjector, content, activeModal, options) {
  8823. if (!content) {
  8824. return new ContentRef([]);
  8825. }
  8826. else if (content instanceof core.TemplateRef) {
  8827. return this._createFromTemplateRef(content, activeModal);
  8828. }
  8829. else if (isString(content)) {
  8830. return this._createFromString(content);
  8831. }
  8832. else {
  8833. return this._createFromComponent(moduleCFR, contentInjector, content, activeModal, options);
  8834. }
  8835. };
  8836. /**
  8837. * @private
  8838. * @param {?} content
  8839. * @param {?} activeModal
  8840. * @return {?}
  8841. */
  8842. NgbModalStack.prototype._createFromTemplateRef = /**
  8843. * @private
  8844. * @param {?} content
  8845. * @param {?} activeModal
  8846. * @return {?}
  8847. */
  8848. function (content, activeModal) {
  8849. /** @type {?} */
  8850. var context = {
  8851. $implicit: activeModal,
  8852. close: /**
  8853. * @param {?} result
  8854. * @return {?}
  8855. */
  8856. function (result) { activeModal.close(result); },
  8857. dismiss: /**
  8858. * @param {?} reason
  8859. * @return {?}
  8860. */
  8861. function (reason) { activeModal.dismiss(reason); }
  8862. };
  8863. /** @type {?} */
  8864. var viewRef = content.createEmbeddedView(context);
  8865. this._applicationRef.attachView(viewRef);
  8866. return new ContentRef([viewRef.rootNodes], viewRef);
  8867. };
  8868. /**
  8869. * @private
  8870. * @param {?} content
  8871. * @return {?}
  8872. */
  8873. NgbModalStack.prototype._createFromString = /**
  8874. * @private
  8875. * @param {?} content
  8876. * @return {?}
  8877. */
  8878. function (content) {
  8879. /** @type {?} */
  8880. var component = this._document.createTextNode("" + content);
  8881. return new ContentRef([[component]]);
  8882. };
  8883. /**
  8884. * @private
  8885. * @param {?} moduleCFR
  8886. * @param {?} contentInjector
  8887. * @param {?} content
  8888. * @param {?} context
  8889. * @param {?} options
  8890. * @return {?}
  8891. */
  8892. NgbModalStack.prototype._createFromComponent = /**
  8893. * @private
  8894. * @param {?} moduleCFR
  8895. * @param {?} contentInjector
  8896. * @param {?} content
  8897. * @param {?} context
  8898. * @param {?} options
  8899. * @return {?}
  8900. */
  8901. function (moduleCFR, contentInjector, content, context, options) {
  8902. /** @type {?} */
  8903. var contentCmptFactory = moduleCFR.resolveComponentFactory(content);
  8904. /** @type {?} */
  8905. var modalContentInjector = core.Injector.create({ providers: [{ provide: NgbActiveModal, useValue: context }], parent: contentInjector });
  8906. /** @type {?} */
  8907. var componentRef = contentCmptFactory.create(modalContentInjector);
  8908. /** @type {?} */
  8909. var componentNativeEl = componentRef.location.nativeElement;
  8910. if (options.scrollable) {
  8911. ((/** @type {?} */ (componentNativeEl))).classList.add('component-host-scrollable');
  8912. }
  8913. this._applicationRef.attachView(componentRef.hostView);
  8914. // FIXME: we should here get rid of the component nativeElement
  8915. // and use `[Array.from(componentNativeEl.childNodes)]` instead and remove the above CSS class.
  8916. return new ContentRef([[componentNativeEl]], componentRef.hostView, componentRef);
  8917. };
  8918. /**
  8919. * @private
  8920. * @param {?} element
  8921. * @return {?}
  8922. */
  8923. NgbModalStack.prototype._setAriaHidden = /**
  8924. * @private
  8925. * @param {?} element
  8926. * @return {?}
  8927. */
  8928. function (element) {
  8929. var _this = this;
  8930. /** @type {?} */
  8931. var parent = element.parentElement;
  8932. if (parent && element !== this._document.body) {
  8933. Array.from(parent.children).forEach((/**
  8934. * @param {?} sibling
  8935. * @return {?}
  8936. */
  8937. function (sibling) {
  8938. if (sibling !== element && sibling.nodeName !== 'SCRIPT') {
  8939. _this._ariaHiddenValues.set(sibling, sibling.getAttribute('aria-hidden'));
  8940. sibling.setAttribute('aria-hidden', 'true');
  8941. }
  8942. }));
  8943. this._setAriaHidden(parent);
  8944. }
  8945. };
  8946. /**
  8947. * @private
  8948. * @return {?}
  8949. */
  8950. NgbModalStack.prototype._revertAriaHidden = /**
  8951. * @private
  8952. * @return {?}
  8953. */
  8954. function () {
  8955. this._ariaHiddenValues.forEach((/**
  8956. * @param {?} value
  8957. * @param {?} element
  8958. * @return {?}
  8959. */
  8960. function (value, element) {
  8961. if (value) {
  8962. element.setAttribute('aria-hidden', value);
  8963. }
  8964. else {
  8965. element.removeAttribute('aria-hidden');
  8966. }
  8967. }));
  8968. this._ariaHiddenValues.clear();
  8969. };
  8970. /**
  8971. * @private
  8972. * @param {?} ngbModalRef
  8973. * @return {?}
  8974. */
  8975. NgbModalStack.prototype._registerModalRef = /**
  8976. * @private
  8977. * @param {?} ngbModalRef
  8978. * @return {?}
  8979. */
  8980. function (ngbModalRef) {
  8981. var _this = this;
  8982. /** @type {?} */
  8983. var unregisterModalRef = (/**
  8984. * @return {?}
  8985. */
  8986. function () {
  8987. /** @type {?} */
  8988. var index = _this._modalRefs.indexOf(ngbModalRef);
  8989. if (index > -1) {
  8990. _this._modalRefs.splice(index, 1);
  8991. }
  8992. });
  8993. this._modalRefs.push(ngbModalRef);
  8994. ngbModalRef.result.then(unregisterModalRef, unregisterModalRef);
  8995. };
  8996. /**
  8997. * @private
  8998. * @param {?} ngbWindowCmpt
  8999. * @return {?}
  9000. */
  9001. NgbModalStack.prototype._registerWindowCmpt = /**
  9002. * @private
  9003. * @param {?} ngbWindowCmpt
  9004. * @return {?}
  9005. */
  9006. function (ngbWindowCmpt) {
  9007. var _this = this;
  9008. this._windowCmpts.push(ngbWindowCmpt);
  9009. this._activeWindowCmptHasChanged.next();
  9010. ngbWindowCmpt.onDestroy((/**
  9011. * @return {?}
  9012. */
  9013. function () {
  9014. /** @type {?} */
  9015. var index = _this._windowCmpts.indexOf(ngbWindowCmpt);
  9016. if (index > -1) {
  9017. _this._windowCmpts.splice(index, 1);
  9018. _this._activeWindowCmptHasChanged.next();
  9019. }
  9020. }));
  9021. };
  9022. NgbModalStack.decorators = [
  9023. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  9024. ];
  9025. /** @nocollapse */
  9026. NgbModalStack.ctorParameters = function () { return [
  9027. { type: core.ApplicationRef },
  9028. { type: core.Injector },
  9029. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  9030. { type: ScrollBar },
  9031. { type: core.RendererFactory2 },
  9032. { type: core.NgZone }
  9033. ]; };
  9034. /** @nocollapse */ NgbModalStack.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbModalStack_Factory() { return new NgbModalStack(core.ɵɵinject(core.ApplicationRef), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(common.DOCUMENT), core.ɵɵinject(ScrollBar), core.ɵɵinject(core.RendererFactory2), core.ɵɵinject(core.NgZone)); }, token: NgbModalStack, providedIn: "root" });
  9035. return NgbModalStack;
  9036. }());
  9037. /**
  9038. * @fileoverview added by tsickle
  9039. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9040. */
  9041. /**
  9042. * A service for opening modal windows.
  9043. *
  9044. * Creating a modal is straightforward: create a component or a template and pass it as an argument to
  9045. * the `.open()` method.
  9046. */
  9047. var NgbModal = /** @class */ (function () {
  9048. function NgbModal(_moduleCFR, _injector, _modalStack, _config) {
  9049. this._moduleCFR = _moduleCFR;
  9050. this._injector = _injector;
  9051. this._modalStack = _modalStack;
  9052. this._config = _config;
  9053. }
  9054. /**
  9055. * Opens a new modal window with the specified content and supplied options.
  9056. *
  9057. * Content can be provided as a `TemplateRef` or a component type. If you pass a component type as content,
  9058. * then instances of those components can be injected with an instance of the `NgbActiveModal` class. You can then
  9059. * use `NgbActiveModal` methods to close / dismiss modals from "inside" of your component.
  9060. *
  9061. * Also see the [`NgbModalOptions`](#/components/modal/api#NgbModalOptions) for the list of supported options.
  9062. */
  9063. /**
  9064. * Opens a new modal window with the specified content and supplied options.
  9065. *
  9066. * Content can be provided as a `TemplateRef` or a component type. If you pass a component type as content,
  9067. * then instances of those components can be injected with an instance of the `NgbActiveModal` class. You can then
  9068. * use `NgbActiveModal` methods to close / dismiss modals from "inside" of your component.
  9069. *
  9070. * Also see the [`NgbModalOptions`](#/components/modal/api#NgbModalOptions) for the list of supported options.
  9071. * @param {?} content
  9072. * @param {?=} options
  9073. * @return {?}
  9074. */
  9075. NgbModal.prototype.open = /**
  9076. * Opens a new modal window with the specified content and supplied options.
  9077. *
  9078. * Content can be provided as a `TemplateRef` or a component type. If you pass a component type as content,
  9079. * then instances of those components can be injected with an instance of the `NgbActiveModal` class. You can then
  9080. * use `NgbActiveModal` methods to close / dismiss modals from "inside" of your component.
  9081. *
  9082. * Also see the [`NgbModalOptions`](#/components/modal/api#NgbModalOptions) for the list of supported options.
  9083. * @param {?} content
  9084. * @param {?=} options
  9085. * @return {?}
  9086. */
  9087. function (content, options) {
  9088. if (options === void 0) { options = {}; }
  9089. /** @type {?} */
  9090. var combinedOptions = Object.assign({}, this._config, options);
  9091. return this._modalStack.open(this._moduleCFR, this._injector, content, combinedOptions);
  9092. };
  9093. /**
  9094. * Dismisses all currently displayed modal windows with the supplied reason.
  9095. *
  9096. * @since 3.1.0
  9097. */
  9098. /**
  9099. * Dismisses all currently displayed modal windows with the supplied reason.
  9100. *
  9101. * \@since 3.1.0
  9102. * @param {?=} reason
  9103. * @return {?}
  9104. */
  9105. NgbModal.prototype.dismissAll = /**
  9106. * Dismisses all currently displayed modal windows with the supplied reason.
  9107. *
  9108. * \@since 3.1.0
  9109. * @param {?=} reason
  9110. * @return {?}
  9111. */
  9112. function (reason) { this._modalStack.dismissAll(reason); };
  9113. /**
  9114. * Indicates if there are currently any open modal windows in the application.
  9115. *
  9116. * @since 3.3.0
  9117. */
  9118. /**
  9119. * Indicates if there are currently any open modal windows in the application.
  9120. *
  9121. * \@since 3.3.0
  9122. * @return {?}
  9123. */
  9124. NgbModal.prototype.hasOpenModals = /**
  9125. * Indicates if there are currently any open modal windows in the application.
  9126. *
  9127. * \@since 3.3.0
  9128. * @return {?}
  9129. */
  9130. function () { return this._modalStack.hasOpenModals(); };
  9131. NgbModal.decorators = [
  9132. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  9133. ];
  9134. /** @nocollapse */
  9135. NgbModal.ctorParameters = function () { return [
  9136. { type: core.ComponentFactoryResolver },
  9137. { type: core.Injector },
  9138. { type: NgbModalStack },
  9139. { type: NgbModalConfig }
  9140. ]; };
  9141. /** @nocollapse */ NgbModal.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbModal_Factory() { return new NgbModal(core.ɵɵinject(core.ComponentFactoryResolver), core.ɵɵinject(core.INJECTOR), core.ɵɵinject(NgbModalStack), core.ɵɵinject(NgbModalConfig)); }, token: NgbModal, providedIn: "root" });
  9142. return NgbModal;
  9143. }());
  9144. /**
  9145. * @fileoverview added by tsickle
  9146. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9147. */
  9148. var NgbModalModule = /** @class */ (function () {
  9149. function NgbModalModule() {
  9150. }
  9151. NgbModalModule.decorators = [
  9152. { type: core.NgModule, args: [{
  9153. declarations: [NgbModalBackdrop, NgbModalWindow],
  9154. entryComponents: [NgbModalBackdrop, NgbModalWindow],
  9155. providers: [NgbModal]
  9156. },] }
  9157. ];
  9158. return NgbModalModule;
  9159. }());
  9160. /**
  9161. * @fileoverview added by tsickle
  9162. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9163. */
  9164. /**
  9165. * A configuration service for the [`NgbNav`](#/components/nav/api#NgbNav) component.
  9166. *
  9167. * You can inject this service, typically in your root component, and customize the values of its properties in
  9168. * order to provide default values for all the navs used in the application.
  9169. *
  9170. * \@since 5.2.0
  9171. */
  9172. var NgbNavConfig = /** @class */ (function () {
  9173. function NgbNavConfig() {
  9174. this.destroyOnHide = true;
  9175. this.orientation = 'horizontal';
  9176. this.roles = 'tablist';
  9177. }
  9178. NgbNavConfig.decorators = [
  9179. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  9180. ];
  9181. /** @nocollapse */ NgbNavConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbNavConfig_Factory() { return new NgbNavConfig(); }, token: NgbNavConfig, providedIn: "root" });
  9182. return NgbNavConfig;
  9183. }());
  9184. /**
  9185. * @fileoverview added by tsickle
  9186. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9187. */
  9188. /** @type {?} */
  9189. var isValidNavId = (/**
  9190. * @param {?} id
  9191. * @return {?}
  9192. */
  9193. function (id) { return isDefined(id) && id !== ''; });
  9194. /** @type {?} */
  9195. var navCounter = 0;
  9196. /**
  9197. * This directive must be used to wrap content to be displayed in the nav.
  9198. *
  9199. * \@since 5.2.0
  9200. */
  9201. var NgbNavContent = /** @class */ (function () {
  9202. function NgbNavContent(templateRef) {
  9203. this.templateRef = templateRef;
  9204. }
  9205. NgbNavContent.decorators = [
  9206. { type: core.Directive, args: [{ selector: 'ng-template[ngbNavContent]' },] }
  9207. ];
  9208. /** @nocollapse */
  9209. NgbNavContent.ctorParameters = function () { return [
  9210. { type: core.TemplateRef }
  9211. ]; };
  9212. return NgbNavContent;
  9213. }());
  9214. /**
  9215. * The directive used to group nav link and related nav content. As well as set nav identifier and some options.
  9216. *
  9217. * \@since 5.2.0
  9218. */
  9219. var NgbNavItem = /** @class */ (function () {
  9220. function NgbNavItem(nav, elementRef) {
  9221. this.elementRef = elementRef;
  9222. /**
  9223. * If `true`, the current nav item is disabled and can't be toggled by user.
  9224. *
  9225. * Nevertheless disabled nav can be selected programmatically via the `.select()` method and the `[activeId]` binding.
  9226. */
  9227. this.disabled = false;
  9228. // TODO: cf https://github.com/angular/angular/issues/30106
  9229. this._nav = nav;
  9230. }
  9231. /**
  9232. * @return {?}
  9233. */
  9234. NgbNavItem.prototype.ngAfterContentChecked = /**
  9235. * @return {?}
  9236. */
  9237. function () {
  9238. // We are using @ContentChildren instead of @ContentChild as in the Angular version being used
  9239. // only @ContentChildren allows us to specify the {descendants: false} option.
  9240. // Without {descendants: false} we are hitting bugs described in:
  9241. // https://github.com/ng-bootstrap/ng-bootstrap/issues/2240
  9242. this.contentTpl = this.contentTpls.first;
  9243. };
  9244. /**
  9245. * @return {?}
  9246. */
  9247. NgbNavItem.prototype.ngOnInit = /**
  9248. * @return {?}
  9249. */
  9250. function () {
  9251. if (!isDefined(this.domId)) {
  9252. this.domId = "ngb-nav-" + navCounter++;
  9253. }
  9254. };
  9255. Object.defineProperty(NgbNavItem.prototype, "active", {
  9256. get: /**
  9257. * @return {?}
  9258. */
  9259. function () { return this._nav.activeId === this.id; },
  9260. enumerable: true,
  9261. configurable: true
  9262. });
  9263. Object.defineProperty(NgbNavItem.prototype, "id", {
  9264. get: /**
  9265. * @return {?}
  9266. */
  9267. function () { return isValidNavId(this._id) ? this._id : this.domId; },
  9268. enumerable: true,
  9269. configurable: true
  9270. });
  9271. Object.defineProperty(NgbNavItem.prototype, "panelDomId", {
  9272. get: /**
  9273. * @return {?}
  9274. */
  9275. function () { return this.domId + "-panel"; },
  9276. enumerable: true,
  9277. configurable: true
  9278. });
  9279. /**
  9280. * @return {?}
  9281. */
  9282. NgbNavItem.prototype.isPanelInDom = /**
  9283. * @return {?}
  9284. */
  9285. function () {
  9286. return (isDefined(this.destroyOnHide) ? !this.destroyOnHide : !this._nav.destroyOnHide) || this.active;
  9287. };
  9288. NgbNavItem.decorators = [
  9289. { type: core.Directive, args: [{ selector: '[ngbNavItem]', exportAs: 'ngbNavItem', host: { '[class.nav-item]': 'true' } },] }
  9290. ];
  9291. /** @nocollapse */
  9292. NgbNavItem.ctorParameters = function () { return [
  9293. { type: undefined, decorators: [{ type: core.Inject, args: [core.forwardRef((/**
  9294. * @return {?}
  9295. */
  9296. function () { return NgbNav; })),] }] },
  9297. { type: core.ElementRef }
  9298. ]; };
  9299. NgbNavItem.propDecorators = {
  9300. destroyOnHide: [{ type: core.Input }],
  9301. disabled: [{ type: core.Input }],
  9302. domId: [{ type: core.Input }],
  9303. _id: [{ type: core.Input, args: ['ngbNavItem',] }],
  9304. contentTpls: [{ type: core.ContentChildren, args: [NgbNavContent, { descendants: false },] }]
  9305. };
  9306. return NgbNavItem;
  9307. }());
  9308. /**
  9309. * A nav directive that helps with implementing tabbed navigation components.
  9310. *
  9311. * \@since 5.2.0
  9312. */
  9313. var NgbNav = /** @class */ (function () {
  9314. function NgbNav(role, config, _cd) {
  9315. this.role = role;
  9316. this._cd = _cd;
  9317. /**
  9318. * The event emitted after the active nav changes
  9319. * The payload of the event is the newly active nav id
  9320. *
  9321. * If you want to prevent nav change, you should use `(navChange)` event
  9322. */
  9323. this.activeIdChange = new core.EventEmitter();
  9324. /**
  9325. * The nav change event emitted right before the nav change happens on user click.
  9326. *
  9327. * This event won't be emitted if nav is changed programmatically via `[activeId]` or `.select()`.
  9328. *
  9329. * See [`NgbNavChangeEvent`](#/components/nav/api#NgbNavChangeEvent) for payload details.
  9330. */
  9331. this.navChange = new core.EventEmitter();
  9332. this.destroyOnHide = config.destroyOnHide;
  9333. this.orientation = config.orientation;
  9334. this.roles = config.roles;
  9335. }
  9336. /**
  9337. * @param {?} item
  9338. * @return {?}
  9339. */
  9340. NgbNav.prototype.click = /**
  9341. * @param {?} item
  9342. * @return {?}
  9343. */
  9344. function (item) {
  9345. if (!item.disabled) {
  9346. this._updateActiveId(item.id);
  9347. }
  9348. };
  9349. /**
  9350. * Selects the nav with the given id and shows its associated pane.
  9351. * Any other nav that was previously selected becomes unselected and its associated pane is hidden.
  9352. */
  9353. /**
  9354. * Selects the nav with the given id and shows its associated pane.
  9355. * Any other nav that was previously selected becomes unselected and its associated pane is hidden.
  9356. * @param {?} id
  9357. * @return {?}
  9358. */
  9359. NgbNav.prototype.select = /**
  9360. * Selects the nav with the given id and shows its associated pane.
  9361. * Any other nav that was previously selected becomes unselected and its associated pane is hidden.
  9362. * @param {?} id
  9363. * @return {?}
  9364. */
  9365. function (id) { this._updateActiveId(id, false); };
  9366. /**
  9367. * @return {?}
  9368. */
  9369. NgbNav.prototype.ngAfterContentInit = /**
  9370. * @return {?}
  9371. */
  9372. function () {
  9373. if (!isDefined(this.activeId)) {
  9374. /** @type {?} */
  9375. var nextId = this.items.first ? this.items.first.id : null;
  9376. if (isValidNavId(nextId)) {
  9377. this._updateActiveId(nextId, false);
  9378. this._cd.detectChanges();
  9379. }
  9380. }
  9381. };
  9382. /**
  9383. * @private
  9384. * @param {?} nextId
  9385. * @param {?=} emitNavChange
  9386. * @return {?}
  9387. */
  9388. NgbNav.prototype._updateActiveId = /**
  9389. * @private
  9390. * @param {?} nextId
  9391. * @param {?=} emitNavChange
  9392. * @return {?}
  9393. */
  9394. function (nextId, emitNavChange) {
  9395. if (emitNavChange === void 0) { emitNavChange = true; }
  9396. if (this.activeId !== nextId) {
  9397. /** @type {?} */
  9398. var defaultPrevented_1 = false;
  9399. if (emitNavChange) {
  9400. this.navChange.emit({ activeId: this.activeId, nextId: nextId, preventDefault: (/**
  9401. * @return {?}
  9402. */
  9403. function () { defaultPrevented_1 = true; }) });
  9404. }
  9405. if (!defaultPrevented_1) {
  9406. this.activeId = nextId;
  9407. this.activeIdChange.emit(nextId);
  9408. }
  9409. }
  9410. };
  9411. NgbNav.decorators = [
  9412. { type: core.Directive, args: [{
  9413. selector: '[ngbNav]',
  9414. exportAs: 'ngbNav',
  9415. host: {
  9416. '[class.nav]': 'true',
  9417. '[class.flex-column]': "orientation === 'vertical'",
  9418. '[attr.aria-orientation]': "orientation === 'vertical' && roles === 'tablist' ? 'vertical' : undefined",
  9419. '[attr.role]': "role ? role : roles ? 'tablist' : undefined",
  9420. }
  9421. },] }
  9422. ];
  9423. /** @nocollapse */
  9424. NgbNav.ctorParameters = function () { return [
  9425. { type: String, decorators: [{ type: core.Attribute, args: ['role',] }] },
  9426. { type: NgbNavConfig },
  9427. { type: core.ChangeDetectorRef }
  9428. ]; };
  9429. NgbNav.propDecorators = {
  9430. activeId: [{ type: core.Input }],
  9431. activeIdChange: [{ type: core.Output }],
  9432. destroyOnHide: [{ type: core.Input }],
  9433. orientation: [{ type: core.Input }],
  9434. roles: [{ type: core.Input }],
  9435. items: [{ type: core.ContentChildren, args: [NgbNavItem,] }],
  9436. navChange: [{ type: core.Output }]
  9437. };
  9438. return NgbNav;
  9439. }());
  9440. /**
  9441. * A directive to put on the nav link.
  9442. *
  9443. * \@since 5.2.0
  9444. */
  9445. var NgbNavLink = /** @class */ (function () {
  9446. function NgbNavLink(role, navItem, nav) {
  9447. this.role = role;
  9448. this.navItem = navItem;
  9449. this.nav = nav;
  9450. }
  9451. /**
  9452. * @return {?}
  9453. */
  9454. NgbNavLink.prototype.hasNavItemClass = /**
  9455. * @return {?}
  9456. */
  9457. function () {
  9458. // with alternative markup we have to add `.nav-item` class, because `ngbNavItem` is on the ng-container
  9459. return this.navItem.elementRef.nativeElement.nodeType === Node.COMMENT_NODE;
  9460. };
  9461. NgbNavLink.decorators = [
  9462. { type: core.Directive, args: [{
  9463. selector: 'a[ngbNavLink]',
  9464. host: {
  9465. '[id]': 'navItem.domId',
  9466. '[class.nav-link]': 'true',
  9467. '[class.nav-item]': 'hasNavItemClass()',
  9468. '[attr.role]': "role ? role : nav.roles ? 'tab' : undefined",
  9469. 'href': '',
  9470. '[class.active]': 'navItem.active',
  9471. '[class.disabled]': 'navItem.disabled',
  9472. '[attr.tabindex]': 'navItem.disabled ? -1 : undefined',
  9473. '[attr.aria-controls]': 'navItem.isPanelInDom() ? navItem.panelDomId : null',
  9474. '[attr.aria-selected]': 'navItem.active',
  9475. '[attr.aria-disabled]': 'navItem.disabled',
  9476. '(click)': 'nav.click(navItem); $event.preventDefault()'
  9477. }
  9478. },] }
  9479. ];
  9480. /** @nocollapse */
  9481. NgbNavLink.ctorParameters = function () { return [
  9482. { type: String, decorators: [{ type: core.Attribute, args: ['role',] }] },
  9483. { type: NgbNavItem },
  9484. { type: NgbNav }
  9485. ]; };
  9486. return NgbNavLink;
  9487. }());
  9488. /**
  9489. * @fileoverview added by tsickle
  9490. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9491. */
  9492. /**
  9493. * The outlet where currently active nav content will be displayed.
  9494. *
  9495. * \@since 5.2.0
  9496. */
  9497. var NgbNavOutlet = /** @class */ (function () {
  9498. function NgbNavOutlet() {
  9499. }
  9500. NgbNavOutlet.decorators = [
  9501. { type: core.Component, args: [{
  9502. selector: '[ngbNavOutlet]',
  9503. host: { '[class.tab-content]': 'true' },
  9504. encapsulation: core.ViewEncapsulation.None,
  9505. template: "\n <ng-template ngFor let-item [ngForOf]=\"nav.items\">\n <div class=\"tab-pane\"\n *ngIf=\"item.isPanelInDom()\"\n [id]=\"item.panelDomId\"\n [class.active]=\"item.active\"\n [attr.role]=\"paneRole ? paneRole : nav.roles ? 'tabpanel' : undefined\"\n [attr.aria-labelledby]=\"item.domId\">\n <ng-template [ngTemplateOutlet]=\"item.contentTpl?.templateRef\" [ngTemplateOutletContext]=\"{$implicit: item.active}\"></ng-template>\n </div>\n </ng-template>\n "
  9506. }] }
  9507. ];
  9508. NgbNavOutlet.propDecorators = {
  9509. paneRole: [{ type: core.Input }],
  9510. nav: [{ type: core.Input, args: ['ngbNavOutlet',] }]
  9511. };
  9512. return NgbNavOutlet;
  9513. }());
  9514. /**
  9515. * @fileoverview added by tsickle
  9516. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9517. */
  9518. /** @type {?} */
  9519. var NGB_NAV_DIRECTIVES = [NgbNavContent, NgbNav, NgbNavItem, NgbNavLink, NgbNavOutlet];
  9520. var NgbNavModule = /** @class */ (function () {
  9521. function NgbNavModule() {
  9522. }
  9523. NgbNavModule.decorators = [
  9524. { type: core.NgModule, args: [{ declarations: NGB_NAV_DIRECTIVES, exports: NGB_NAV_DIRECTIVES, imports: [common.CommonModule] },] }
  9525. ];
  9526. return NgbNavModule;
  9527. }());
  9528. /**
  9529. * @fileoverview added by tsickle
  9530. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9531. */
  9532. /**
  9533. * A configuration service for the [`NgbPagination`](#/components/pagination/api#NgbPagination) component.
  9534. *
  9535. * You can inject this service, typically in your root component, and customize the values of its properties in
  9536. * order to provide default values for all the paginations used in the application.
  9537. */
  9538. var NgbPaginationConfig = /** @class */ (function () {
  9539. function NgbPaginationConfig() {
  9540. this.disabled = false;
  9541. this.boundaryLinks = false;
  9542. this.directionLinks = true;
  9543. this.ellipses = true;
  9544. this.maxSize = 0;
  9545. this.pageSize = 10;
  9546. this.rotate = false;
  9547. }
  9548. NgbPaginationConfig.decorators = [
  9549. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  9550. ];
  9551. /** @nocollapse */ NgbPaginationConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbPaginationConfig_Factory() { return new NgbPaginationConfig(); }, token: NgbPaginationConfig, providedIn: "root" });
  9552. return NgbPaginationConfig;
  9553. }());
  9554. /**
  9555. * @fileoverview added by tsickle
  9556. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9557. */
  9558. /**
  9559. * A directive to match the 'ellipsis' link template
  9560. *
  9561. * \@since 4.1.0
  9562. */
  9563. var NgbPaginationEllipsis = /** @class */ (function () {
  9564. function NgbPaginationEllipsis(templateRef) {
  9565. this.templateRef = templateRef;
  9566. }
  9567. NgbPaginationEllipsis.decorators = [
  9568. { type: core.Directive, args: [{ selector: 'ng-template[ngbPaginationEllipsis]' },] }
  9569. ];
  9570. /** @nocollapse */
  9571. NgbPaginationEllipsis.ctorParameters = function () { return [
  9572. { type: core.TemplateRef }
  9573. ]; };
  9574. return NgbPaginationEllipsis;
  9575. }());
  9576. /**
  9577. * A directive to match the 'first' link template
  9578. *
  9579. * \@since 4.1.0
  9580. */
  9581. var NgbPaginationFirst = /** @class */ (function () {
  9582. function NgbPaginationFirst(templateRef) {
  9583. this.templateRef = templateRef;
  9584. }
  9585. NgbPaginationFirst.decorators = [
  9586. { type: core.Directive, args: [{ selector: 'ng-template[ngbPaginationFirst]' },] }
  9587. ];
  9588. /** @nocollapse */
  9589. NgbPaginationFirst.ctorParameters = function () { return [
  9590. { type: core.TemplateRef }
  9591. ]; };
  9592. return NgbPaginationFirst;
  9593. }());
  9594. /**
  9595. * A directive to match the 'last' link template
  9596. *
  9597. * \@since 4.1.0
  9598. */
  9599. var NgbPaginationLast = /** @class */ (function () {
  9600. function NgbPaginationLast(templateRef) {
  9601. this.templateRef = templateRef;
  9602. }
  9603. NgbPaginationLast.decorators = [
  9604. { type: core.Directive, args: [{ selector: 'ng-template[ngbPaginationLast]' },] }
  9605. ];
  9606. /** @nocollapse */
  9607. NgbPaginationLast.ctorParameters = function () { return [
  9608. { type: core.TemplateRef }
  9609. ]; };
  9610. return NgbPaginationLast;
  9611. }());
  9612. /**
  9613. * A directive to match the 'next' link template
  9614. *
  9615. * \@since 4.1.0
  9616. */
  9617. var NgbPaginationNext = /** @class */ (function () {
  9618. function NgbPaginationNext(templateRef) {
  9619. this.templateRef = templateRef;
  9620. }
  9621. NgbPaginationNext.decorators = [
  9622. { type: core.Directive, args: [{ selector: 'ng-template[ngbPaginationNext]' },] }
  9623. ];
  9624. /** @nocollapse */
  9625. NgbPaginationNext.ctorParameters = function () { return [
  9626. { type: core.TemplateRef }
  9627. ]; };
  9628. return NgbPaginationNext;
  9629. }());
  9630. /**
  9631. * A directive to match the page 'number' link template
  9632. *
  9633. * \@since 4.1.0
  9634. */
  9635. var NgbPaginationNumber = /** @class */ (function () {
  9636. function NgbPaginationNumber(templateRef) {
  9637. this.templateRef = templateRef;
  9638. }
  9639. NgbPaginationNumber.decorators = [
  9640. { type: core.Directive, args: [{ selector: 'ng-template[ngbPaginationNumber]' },] }
  9641. ];
  9642. /** @nocollapse */
  9643. NgbPaginationNumber.ctorParameters = function () { return [
  9644. { type: core.TemplateRef }
  9645. ]; };
  9646. return NgbPaginationNumber;
  9647. }());
  9648. /**
  9649. * A directive to match the 'previous' link template
  9650. *
  9651. * \@since 4.1.0
  9652. */
  9653. var NgbPaginationPrevious = /** @class */ (function () {
  9654. function NgbPaginationPrevious(templateRef) {
  9655. this.templateRef = templateRef;
  9656. }
  9657. NgbPaginationPrevious.decorators = [
  9658. { type: core.Directive, args: [{ selector: 'ng-template[ngbPaginationPrevious]' },] }
  9659. ];
  9660. /** @nocollapse */
  9661. NgbPaginationPrevious.ctorParameters = function () { return [
  9662. { type: core.TemplateRef }
  9663. ]; };
  9664. return NgbPaginationPrevious;
  9665. }());
  9666. /**
  9667. * A component that displays page numbers and allows to customize them in several ways.
  9668. */
  9669. var NgbPagination = /** @class */ (function () {
  9670. function NgbPagination(config) {
  9671. this.pageCount = 0;
  9672. this.pages = [];
  9673. /**
  9674. * The current page.
  9675. *
  9676. * Page numbers start with `1`.
  9677. */
  9678. this.page = 1;
  9679. /**
  9680. * An event fired when the page is changed. Will fire only if collection size is set and all values are valid.
  9681. *
  9682. * Event payload is the number of the newly selected page.
  9683. *
  9684. * Page numbers start with `1`.
  9685. */
  9686. this.pageChange = new core.EventEmitter(true);
  9687. this.disabled = config.disabled;
  9688. this.boundaryLinks = config.boundaryLinks;
  9689. this.directionLinks = config.directionLinks;
  9690. this.ellipses = config.ellipses;
  9691. this.maxSize = config.maxSize;
  9692. this.pageSize = config.pageSize;
  9693. this.rotate = config.rotate;
  9694. this.size = config.size;
  9695. }
  9696. /**
  9697. * @return {?}
  9698. */
  9699. NgbPagination.prototype.hasPrevious = /**
  9700. * @return {?}
  9701. */
  9702. function () { return this.page > 1; };
  9703. /**
  9704. * @return {?}
  9705. */
  9706. NgbPagination.prototype.hasNext = /**
  9707. * @return {?}
  9708. */
  9709. function () { return this.page < this.pageCount; };
  9710. /**
  9711. * @return {?}
  9712. */
  9713. NgbPagination.prototype.nextDisabled = /**
  9714. * @return {?}
  9715. */
  9716. function () { return !this.hasNext() || this.disabled; };
  9717. /**
  9718. * @return {?}
  9719. */
  9720. NgbPagination.prototype.previousDisabled = /**
  9721. * @return {?}
  9722. */
  9723. function () { return !this.hasPrevious() || this.disabled; };
  9724. /**
  9725. * @param {?} pageNumber
  9726. * @return {?}
  9727. */
  9728. NgbPagination.prototype.selectPage = /**
  9729. * @param {?} pageNumber
  9730. * @return {?}
  9731. */
  9732. function (pageNumber) { this._updatePages(pageNumber); };
  9733. /**
  9734. * @param {?} changes
  9735. * @return {?}
  9736. */
  9737. NgbPagination.prototype.ngOnChanges = /**
  9738. * @param {?} changes
  9739. * @return {?}
  9740. */
  9741. function (changes) { this._updatePages(this.page); };
  9742. /**
  9743. * @param {?} pageNumber
  9744. * @return {?}
  9745. */
  9746. NgbPagination.prototype.isEllipsis = /**
  9747. * @param {?} pageNumber
  9748. * @return {?}
  9749. */
  9750. function (pageNumber) { return pageNumber === -1; };
  9751. /**
  9752. * Appends ellipses and first/last page number to the displayed pages
  9753. */
  9754. /**
  9755. * Appends ellipses and first/last page number to the displayed pages
  9756. * @private
  9757. * @param {?} start
  9758. * @param {?} end
  9759. * @return {?}
  9760. */
  9761. NgbPagination.prototype._applyEllipses = /**
  9762. * Appends ellipses and first/last page number to the displayed pages
  9763. * @private
  9764. * @param {?} start
  9765. * @param {?} end
  9766. * @return {?}
  9767. */
  9768. function (start, end) {
  9769. if (this.ellipses) {
  9770. if (start > 0) {
  9771. // The first page will always be included. If the displayed range
  9772. // starts after the third page, then add ellipsis. But if the range
  9773. // starts on the third page, then add the second page instead of
  9774. // an ellipsis, because the ellipsis would only hide a single page.
  9775. if (start > 2) {
  9776. this.pages.unshift(-1);
  9777. }
  9778. else if (start === 2) {
  9779. this.pages.unshift(2);
  9780. }
  9781. this.pages.unshift(1);
  9782. }
  9783. if (end < this.pageCount) {
  9784. // The last page will always be included. If the displayed range
  9785. // ends before the third-last page, then add ellipsis. But if the range
  9786. // ends on third-last page, then add the second-last page instead of
  9787. // an ellipsis, because the ellipsis would only hide a single page.
  9788. if (end < (this.pageCount - 2)) {
  9789. this.pages.push(-1);
  9790. }
  9791. else if (end === (this.pageCount - 2)) {
  9792. this.pages.push(this.pageCount - 1);
  9793. }
  9794. this.pages.push(this.pageCount);
  9795. }
  9796. }
  9797. };
  9798. /**
  9799. * Rotates page numbers based on maxSize items visible.
  9800. * Currently selected page stays in the middle:
  9801. *
  9802. * Ex. for selected page = 6:
  9803. * [5,*6*,7] for maxSize = 3
  9804. * [4,5,*6*,7] for maxSize = 4
  9805. */
  9806. /**
  9807. * Rotates page numbers based on maxSize items visible.
  9808. * Currently selected page stays in the middle:
  9809. *
  9810. * Ex. for selected page = 6:
  9811. * [5,*6*,7] for maxSize = 3
  9812. * [4,5,*6*,7] for maxSize = 4
  9813. * @private
  9814. * @return {?}
  9815. */
  9816. NgbPagination.prototype._applyRotation = /**
  9817. * Rotates page numbers based on maxSize items visible.
  9818. * Currently selected page stays in the middle:
  9819. *
  9820. * Ex. for selected page = 6:
  9821. * [5,*6*,7] for maxSize = 3
  9822. * [4,5,*6*,7] for maxSize = 4
  9823. * @private
  9824. * @return {?}
  9825. */
  9826. function () {
  9827. /** @type {?} */
  9828. var start = 0;
  9829. /** @type {?} */
  9830. var end = this.pageCount;
  9831. /** @type {?} */
  9832. var leftOffset = Math.floor(this.maxSize / 2);
  9833. /** @type {?} */
  9834. var rightOffset = this.maxSize % 2 === 0 ? leftOffset - 1 : leftOffset;
  9835. if (this.page <= leftOffset) {
  9836. // very beginning, no rotation -> [0..maxSize]
  9837. end = this.maxSize;
  9838. }
  9839. else if (this.pageCount - this.page < leftOffset) {
  9840. // very end, no rotation -> [len-maxSize..len]
  9841. start = this.pageCount - this.maxSize;
  9842. }
  9843. else {
  9844. // rotate
  9845. start = this.page - leftOffset - 1;
  9846. end = this.page + rightOffset;
  9847. }
  9848. return [start, end];
  9849. };
  9850. /**
  9851. * Paginates page numbers based on maxSize items per page.
  9852. */
  9853. /**
  9854. * Paginates page numbers based on maxSize items per page.
  9855. * @private
  9856. * @return {?}
  9857. */
  9858. NgbPagination.prototype._applyPagination = /**
  9859. * Paginates page numbers based on maxSize items per page.
  9860. * @private
  9861. * @return {?}
  9862. */
  9863. function () {
  9864. /** @type {?} */
  9865. var page = Math.ceil(this.page / this.maxSize) - 1;
  9866. /** @type {?} */
  9867. var start = page * this.maxSize;
  9868. /** @type {?} */
  9869. var end = start + this.maxSize;
  9870. return [start, end];
  9871. };
  9872. /**
  9873. * @private
  9874. * @param {?} newPageNo
  9875. * @return {?}
  9876. */
  9877. NgbPagination.prototype._setPageInRange = /**
  9878. * @private
  9879. * @param {?} newPageNo
  9880. * @return {?}
  9881. */
  9882. function (newPageNo) {
  9883. /** @type {?} */
  9884. var prevPageNo = this.page;
  9885. this.page = getValueInRange(newPageNo, this.pageCount, 1);
  9886. if (this.page !== prevPageNo && isNumber(this.collectionSize)) {
  9887. this.pageChange.emit(this.page);
  9888. }
  9889. };
  9890. /**
  9891. * @private
  9892. * @param {?} newPage
  9893. * @return {?}
  9894. */
  9895. NgbPagination.prototype._updatePages = /**
  9896. * @private
  9897. * @param {?} newPage
  9898. * @return {?}
  9899. */
  9900. function (newPage) {
  9901. var _a, _b;
  9902. this.pageCount = Math.ceil(this.collectionSize / this.pageSize);
  9903. if (!isNumber(this.pageCount)) {
  9904. this.pageCount = 0;
  9905. }
  9906. // fill-in model needed to render pages
  9907. this.pages.length = 0;
  9908. for (var i = 1; i <= this.pageCount; i++) {
  9909. this.pages.push(i);
  9910. }
  9911. // set page within 1..max range
  9912. this._setPageInRange(newPage);
  9913. // apply maxSize if necessary
  9914. if (this.maxSize > 0 && this.pageCount > this.maxSize) {
  9915. /** @type {?} */
  9916. var start = 0;
  9917. /** @type {?} */
  9918. var end = this.pageCount;
  9919. // either paginating or rotating page numbers
  9920. if (this.rotate) {
  9921. _a = __read(this._applyRotation(), 2), start = _a[0], end = _a[1];
  9922. }
  9923. else {
  9924. _b = __read(this._applyPagination(), 2), start = _b[0], end = _b[1];
  9925. }
  9926. this.pages = this.pages.slice(start, end);
  9927. // adding ellipses
  9928. this._applyEllipses(start, end);
  9929. }
  9930. };
  9931. NgbPagination.decorators = [
  9932. { type: core.Component, args: [{
  9933. selector: 'ngb-pagination',
  9934. changeDetection: core.ChangeDetectionStrategy.OnPush,
  9935. host: { 'role': 'navigation' },
  9936. template: "\n <ng-template #first><span aria-hidden=\"true\" i18n=\"@@ngb.pagination.first\">&laquo;&laquo;</span></ng-template>\n <ng-template #previous><span aria-hidden=\"true\" i18n=\"@@ngb.pagination.previous\">&laquo;</span></ng-template>\n <ng-template #next><span aria-hidden=\"true\" i18n=\"@@ngb.pagination.next\">&raquo;</span></ng-template>\n <ng-template #last><span aria-hidden=\"true\" i18n=\"@@ngb.pagination.last\">&raquo;&raquo;</span></ng-template>\n <ng-template #ellipsis>...</ng-template>\n <ng-template #defaultNumber let-page let-currentPage=\"currentPage\">\n {{ page }}\n <span *ngIf=\"page === currentPage\" class=\"sr-only\">(current)</span>\n </ng-template>\n <ul [class]=\"'pagination' + (size ? ' pagination-' + size : '')\">\n <li *ngIf=\"boundaryLinks\" class=\"page-item\"\n [class.disabled]=\"previousDisabled()\">\n <a aria-label=\"First\" i18n-aria-label=\"@@ngb.pagination.first-aria\" class=\"page-link\" href\n (click)=\"selectPage(1); $event.preventDefault()\" [attr.tabindex]=\"previousDisabled() ? '-1' : null\"\n [attr.aria-disabled]=\"previousDisabled() ? 'true' : null\">\n <ng-template [ngTemplateOutlet]=\"tplFirst?.templateRef || first\"\n [ngTemplateOutletContext]=\"{disabled: previousDisabled(), currentPage: page}\"></ng-template>\n </a>\n </li>\n\n <li *ngIf=\"directionLinks\" class=\"page-item\"\n [class.disabled]=\"previousDisabled()\">\n <a aria-label=\"Previous\" i18n-aria-label=\"@@ngb.pagination.previous-aria\" class=\"page-link\" href\n (click)=\"selectPage(page-1); $event.preventDefault()\" [attr.tabindex]=\"previousDisabled() ? '-1' : null\"\n [attr.aria-disabled]=\"previousDisabled() ? 'true' : null\">\n <ng-template [ngTemplateOutlet]=\"tplPrevious?.templateRef || previous\"\n [ngTemplateOutletContext]=\"{disabled: previousDisabled()}\"></ng-template>\n </a>\n </li>\n <li *ngFor=\"let pageNumber of pages\" class=\"page-item\" [class.active]=\"pageNumber === page\"\n [class.disabled]=\"isEllipsis(pageNumber) || disabled\" [attr.aria-current]=\"(pageNumber === page ? 'page' : null)\">\n <a *ngIf=\"isEllipsis(pageNumber)\" class=\"page-link\" tabindex=\"-1\" aria-disabled=\"true\">\n <ng-template [ngTemplateOutlet]=\"tplEllipsis?.templateRef || ellipsis\"\n [ngTemplateOutletContext]=\"{disabled: true, currentPage: page}\"></ng-template>\n </a>\n <a *ngIf=\"!isEllipsis(pageNumber)\" class=\"page-link\" href (click)=\"selectPage(pageNumber); $event.preventDefault()\" [attr.tabindex]=\"disabled ? '-1' : null\"\n [attr.aria-disabled]=\"disabled ? 'true' : null\">\n <ng-template [ngTemplateOutlet]=\"tplNumber?.templateRef || defaultNumber\"\n [ngTemplateOutletContext]=\"{disabled: disabled, $implicit: pageNumber, currentPage: page}\"></ng-template>\n </a>\n </li>\n <li *ngIf=\"directionLinks\" class=\"page-item\" [class.disabled]=\"nextDisabled()\">\n <a aria-label=\"Next\" i18n-aria-label=\"@@ngb.pagination.next-aria\" class=\"page-link\" href\n (click)=\"selectPage(page+1); $event.preventDefault()\" [attr.tabindex]=\"nextDisabled() ? '-1' : null\"\n [attr.aria-disabled]=\"nextDisabled() ? 'true' : null\">\n <ng-template [ngTemplateOutlet]=\"tplNext?.templateRef || next\"\n [ngTemplateOutletContext]=\"{disabled: nextDisabled(), currentPage: page}\"></ng-template>\n </a>\n </li>\n\n <li *ngIf=\"boundaryLinks\" class=\"page-item\" [class.disabled]=\"nextDisabled()\">\n <a aria-label=\"Last\" i18n-aria-label=\"@@ngb.pagination.last-aria\" class=\"page-link\" href\n (click)=\"selectPage(pageCount); $event.preventDefault()\" [attr.tabindex]=\"nextDisabled() ? '-1' : null\"\n [attr.aria-disabled]=\"nextDisabled() ? 'true' : null\">\n <ng-template [ngTemplateOutlet]=\"tplLast?.templateRef || last\"\n [ngTemplateOutletContext]=\"{disabled: nextDisabled(), currentPage: page}\"></ng-template>\n </a>\n </li>\n </ul>\n "
  9937. }] }
  9938. ];
  9939. /** @nocollapse */
  9940. NgbPagination.ctorParameters = function () { return [
  9941. { type: NgbPaginationConfig }
  9942. ]; };
  9943. NgbPagination.propDecorators = {
  9944. tplEllipsis: [{ type: core.ContentChild, args: [NgbPaginationEllipsis, { static: false },] }],
  9945. tplFirst: [{ type: core.ContentChild, args: [NgbPaginationFirst, { static: false },] }],
  9946. tplLast: [{ type: core.ContentChild, args: [NgbPaginationLast, { static: false },] }],
  9947. tplNext: [{ type: core.ContentChild, args: [NgbPaginationNext, { static: false },] }],
  9948. tplNumber: [{ type: core.ContentChild, args: [NgbPaginationNumber, { static: false },] }],
  9949. tplPrevious: [{ type: core.ContentChild, args: [NgbPaginationPrevious, { static: false },] }],
  9950. disabled: [{ type: core.Input }],
  9951. boundaryLinks: [{ type: core.Input }],
  9952. directionLinks: [{ type: core.Input }],
  9953. ellipses: [{ type: core.Input }],
  9954. rotate: [{ type: core.Input }],
  9955. collectionSize: [{ type: core.Input }],
  9956. maxSize: [{ type: core.Input }],
  9957. page: [{ type: core.Input }],
  9958. pageSize: [{ type: core.Input }],
  9959. pageChange: [{ type: core.Output }],
  9960. size: [{ type: core.Input }]
  9961. };
  9962. return NgbPagination;
  9963. }());
  9964. /**
  9965. * @fileoverview added by tsickle
  9966. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9967. */
  9968. /** @type {?} */
  9969. var DIRECTIVES = [
  9970. NgbPagination, NgbPaginationEllipsis, NgbPaginationFirst, NgbPaginationLast, NgbPaginationNext, NgbPaginationNumber,
  9971. NgbPaginationPrevious
  9972. ];
  9973. var NgbPaginationModule = /** @class */ (function () {
  9974. function NgbPaginationModule() {
  9975. }
  9976. NgbPaginationModule.decorators = [
  9977. { type: core.NgModule, args: [{ declarations: DIRECTIVES, exports: DIRECTIVES, imports: [common.CommonModule] },] }
  9978. ];
  9979. return NgbPaginationModule;
  9980. }());
  9981. /**
  9982. * @fileoverview added by tsickle
  9983. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  9984. */
  9985. var Trigger = /** @class */ (function () {
  9986. function Trigger(open, close) {
  9987. this.open = open;
  9988. this.close = close;
  9989. if (!close) {
  9990. this.close = open;
  9991. }
  9992. }
  9993. /**
  9994. * @return {?}
  9995. */
  9996. Trigger.prototype.isManual = /**
  9997. * @return {?}
  9998. */
  9999. function () { return this.open === 'manual' || this.close === 'manual'; };
  10000. return Trigger;
  10001. }());
  10002. /** @type {?} */
  10003. var DEFAULT_ALIASES = {
  10004. 'hover': ['mouseenter', 'mouseleave'],
  10005. 'focus': ['focusin', 'focusout'],
  10006. };
  10007. /**
  10008. * @param {?} triggers
  10009. * @param {?=} aliases
  10010. * @return {?}
  10011. */
  10012. function parseTriggers(triggers, aliases) {
  10013. if (aliases === void 0) { aliases = DEFAULT_ALIASES; }
  10014. /** @type {?} */
  10015. var trimmedTriggers = (triggers || '').trim();
  10016. if (trimmedTriggers.length === 0) {
  10017. return [];
  10018. }
  10019. /** @type {?} */
  10020. var parsedTriggers = trimmedTriggers.split(/\s+/).map((/**
  10021. * @param {?} trigger
  10022. * @return {?}
  10023. */
  10024. function (trigger) { return trigger.split(':'); })).map((/**
  10025. * @param {?} triggerPair
  10026. * @return {?}
  10027. */
  10028. function (triggerPair) {
  10029. /** @type {?} */
  10030. var alias = aliases[triggerPair[0]] || triggerPair;
  10031. return new Trigger(alias[0], alias[1]);
  10032. }));
  10033. /** @type {?} */
  10034. var manualTriggers = parsedTriggers.filter((/**
  10035. * @param {?} triggerPair
  10036. * @return {?}
  10037. */
  10038. function (triggerPair) { return triggerPair.isManual(); }));
  10039. if (manualTriggers.length > 1) {
  10040. throw 'Triggers parse error: only one manual trigger is allowed';
  10041. }
  10042. if (manualTriggers.length === 1 && parsedTriggers.length > 1) {
  10043. throw 'Triggers parse error: manual trigger can\'t be mixed with other triggers';
  10044. }
  10045. return parsedTriggers;
  10046. }
  10047. /**
  10048. * @param {?} renderer
  10049. * @param {?} nativeElement
  10050. * @param {?} triggers
  10051. * @param {?} isOpenedFn
  10052. * @return {?}
  10053. */
  10054. function observeTriggers(renderer, nativeElement, triggers, isOpenedFn) {
  10055. return new rxjs.Observable((/**
  10056. * @param {?} subscriber
  10057. * @return {?}
  10058. */
  10059. function (subscriber) {
  10060. /** @type {?} */
  10061. var listeners = [];
  10062. /** @type {?} */
  10063. var openFn = (/**
  10064. * @return {?}
  10065. */
  10066. function () { return subscriber.next(true); });
  10067. /** @type {?} */
  10068. var closeFn = (/**
  10069. * @return {?}
  10070. */
  10071. function () { return subscriber.next(false); });
  10072. /** @type {?} */
  10073. var toggleFn = (/**
  10074. * @return {?}
  10075. */
  10076. function () { return subscriber.next(!isOpenedFn()); });
  10077. triggers.forEach((/**
  10078. * @param {?} trigger
  10079. * @return {?}
  10080. */
  10081. function (trigger) {
  10082. if (trigger.open === trigger.close) {
  10083. listeners.push(renderer.listen(nativeElement, trigger.open, toggleFn));
  10084. }
  10085. else {
  10086. listeners.push(renderer.listen(nativeElement, trigger.open, openFn), renderer.listen(nativeElement, trigger.close, closeFn));
  10087. }
  10088. }));
  10089. return (/**
  10090. * @return {?}
  10091. */
  10092. function () { listeners.forEach((/**
  10093. * @param {?} unsubscribeFn
  10094. * @return {?}
  10095. */
  10096. function (unsubscribeFn) { return unsubscribeFn(); })); });
  10097. }));
  10098. }
  10099. /** @type {?} */
  10100. var delayOrNoop = (/**
  10101. * @template T
  10102. * @param {?} time
  10103. * @return {?}
  10104. */
  10105. function (time) { return time > 0 ? operators.delay(time) : (/**
  10106. * @param {?} a
  10107. * @return {?}
  10108. */
  10109. function (a) { return a; }); });
  10110. /**
  10111. * @param {?} openDelay
  10112. * @param {?} closeDelay
  10113. * @param {?} isOpenedFn
  10114. * @return {?}
  10115. */
  10116. function triggerDelay(openDelay, closeDelay, isOpenedFn) {
  10117. return (/**
  10118. * @param {?} input$
  10119. * @return {?}
  10120. */
  10121. function (input$) {
  10122. /** @type {?} */
  10123. var pending = null;
  10124. /** @type {?} */
  10125. var filteredInput$ = input$.pipe(operators.map((/**
  10126. * @param {?} open
  10127. * @return {?}
  10128. */
  10129. function (open) { return ({ open: open }); })), operators.filter((/**
  10130. * @param {?} event
  10131. * @return {?}
  10132. */
  10133. function (event) {
  10134. /** @type {?} */
  10135. var currentlyOpen = isOpenedFn();
  10136. if (currentlyOpen !== event.open && (!pending || pending.open === currentlyOpen)) {
  10137. pending = event;
  10138. return true;
  10139. }
  10140. if (pending && pending.open !== event.open) {
  10141. pending = null;
  10142. }
  10143. return false;
  10144. })), operators.share());
  10145. /** @type {?} */
  10146. var delayedOpen$ = filteredInput$.pipe(operators.filter((/**
  10147. * @param {?} event
  10148. * @return {?}
  10149. */
  10150. function (event) { return event.open; })), delayOrNoop(openDelay));
  10151. /** @type {?} */
  10152. var delayedClose$ = filteredInput$.pipe(operators.filter((/**
  10153. * @param {?} event
  10154. * @return {?}
  10155. */
  10156. function (event) { return !event.open; })), delayOrNoop(closeDelay));
  10157. return rxjs.merge(delayedOpen$, delayedClose$)
  10158. .pipe(operators.filter((/**
  10159. * @param {?} event
  10160. * @return {?}
  10161. */
  10162. function (event) {
  10163. if (event === pending) {
  10164. pending = null;
  10165. return event.open !== isOpenedFn();
  10166. }
  10167. return false;
  10168. })), operators.map((/**
  10169. * @param {?} event
  10170. * @return {?}
  10171. */
  10172. function (event) { return event.open; })));
  10173. });
  10174. }
  10175. /**
  10176. * @param {?} renderer
  10177. * @param {?} nativeElement
  10178. * @param {?} triggers
  10179. * @param {?} isOpenedFn
  10180. * @param {?} openFn
  10181. * @param {?} closeFn
  10182. * @param {?=} openDelay
  10183. * @param {?=} closeDelay
  10184. * @return {?}
  10185. */
  10186. function listenToTriggers(renderer, nativeElement, triggers, isOpenedFn, openFn, closeFn, openDelay, closeDelay) {
  10187. if (openDelay === void 0) { openDelay = 0; }
  10188. if (closeDelay === void 0) { closeDelay = 0; }
  10189. /** @type {?} */
  10190. var parsedTriggers = parseTriggers(triggers);
  10191. if (parsedTriggers.length === 1 && parsedTriggers[0].isManual()) {
  10192. return (/**
  10193. * @return {?}
  10194. */
  10195. function () { });
  10196. }
  10197. /** @type {?} */
  10198. var subscription = observeTriggers(renderer, nativeElement, parsedTriggers, isOpenedFn)
  10199. .pipe(triggerDelay(openDelay, closeDelay, isOpenedFn))
  10200. .subscribe((/**
  10201. * @param {?} open
  10202. * @return {?}
  10203. */
  10204. function (open) { return (open ? openFn() : closeFn()); }));
  10205. return (/**
  10206. * @return {?}
  10207. */
  10208. function () { return subscription.unsubscribe(); });
  10209. }
  10210. /**
  10211. * @fileoverview added by tsickle
  10212. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10213. */
  10214. /**
  10215. * A configuration service for the [`NgbPopover`](#/components/popover/api#NgbPopover) component.
  10216. *
  10217. * You can inject this service, typically in your root component, and customize the values of its properties in
  10218. * order to provide default values for all the popovers used in the application.
  10219. */
  10220. var NgbPopoverConfig = /** @class */ (function () {
  10221. function NgbPopoverConfig() {
  10222. this.autoClose = true;
  10223. this.placement = 'auto';
  10224. this.triggers = 'click';
  10225. this.disablePopover = false;
  10226. this.openDelay = 0;
  10227. this.closeDelay = 0;
  10228. }
  10229. NgbPopoverConfig.decorators = [
  10230. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  10231. ];
  10232. /** @nocollapse */ NgbPopoverConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbPopoverConfig_Factory() { return new NgbPopoverConfig(); }, token: NgbPopoverConfig, providedIn: "root" });
  10233. return NgbPopoverConfig;
  10234. }());
  10235. /**
  10236. * @fileoverview added by tsickle
  10237. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10238. */
  10239. /** @type {?} */
  10240. var nextId$3 = 0;
  10241. var NgbPopoverWindow = /** @class */ (function () {
  10242. function NgbPopoverWindow() {
  10243. }
  10244. /**
  10245. * @return {?}
  10246. */
  10247. NgbPopoverWindow.prototype.isTitleTemplate = /**
  10248. * @return {?}
  10249. */
  10250. function () { return this.title instanceof core.TemplateRef; };
  10251. NgbPopoverWindow.decorators = [
  10252. { type: core.Component, args: [{
  10253. selector: 'ngb-popover-window',
  10254. changeDetection: core.ChangeDetectionStrategy.OnPush,
  10255. encapsulation: core.ViewEncapsulation.None,
  10256. host: { '[class]': '"popover" + (popoverClass ? " " + popoverClass : "")', 'role': 'tooltip', '[id]': 'id' },
  10257. template: "\n <div class=\"arrow\"></div>\n <h3 class=\"popover-header\" *ngIf=\"title != null\">\n <ng-template #simpleTitle>{{title}}</ng-template>\n <ng-template [ngTemplateOutlet]=\"isTitleTemplate() ? title : simpleTitle\" [ngTemplateOutletContext]=\"context\"></ng-template>\n </h3>\n <div class=\"popover-body\"><ng-content></ng-content></div>",
  10258. styles: ["ngb-popover-window.bs-popover-bottom>.arrow,ngb-popover-window.bs-popover-top>.arrow{left:50%;margin-left:-.5rem}ngb-popover-window.bs-popover-bottom-left>.arrow,ngb-popover-window.bs-popover-top-left>.arrow{left:2em}ngb-popover-window.bs-popover-bottom-right>.arrow,ngb-popover-window.bs-popover-top-right>.arrow{left:auto;right:2em}ngb-popover-window.bs-popover-left>.arrow,ngb-popover-window.bs-popover-right>.arrow{top:50%;margin-top:-.5rem}ngb-popover-window.bs-popover-left-top>.arrow,ngb-popover-window.bs-popover-right-top>.arrow{top:.7em}ngb-popover-window.bs-popover-left-bottom>.arrow,ngb-popover-window.bs-popover-right-bottom>.arrow{top:auto;bottom:.7em}"]
  10259. }] }
  10260. ];
  10261. NgbPopoverWindow.propDecorators = {
  10262. title: [{ type: core.Input }],
  10263. id: [{ type: core.Input }],
  10264. popoverClass: [{ type: core.Input }],
  10265. context: [{ type: core.Input }]
  10266. };
  10267. return NgbPopoverWindow;
  10268. }());
  10269. /**
  10270. * A lightweight and extensible directive for fancy popover creation.
  10271. */
  10272. var NgbPopover = /** @class */ (function () {
  10273. function NgbPopover(_elementRef, _renderer, injector, componentFactoryResolver, viewContainerRef, config, _ngZone, _document, _changeDetector, applicationRef) {
  10274. var _this = this;
  10275. this._elementRef = _elementRef;
  10276. this._renderer = _renderer;
  10277. this._ngZone = _ngZone;
  10278. this._document = _document;
  10279. this._changeDetector = _changeDetector;
  10280. /**
  10281. * An event emitted when the popover is shown. Contains no payload.
  10282. */
  10283. this.shown = new core.EventEmitter();
  10284. /**
  10285. * An event emitted when the popover is hidden. Contains no payload.
  10286. */
  10287. this.hidden = new core.EventEmitter();
  10288. this._ngbPopoverWindowId = "ngb-popover-" + nextId$3++;
  10289. this.autoClose = config.autoClose;
  10290. this.placement = config.placement;
  10291. this.triggers = config.triggers;
  10292. this.container = config.container;
  10293. this.disablePopover = config.disablePopover;
  10294. this.popoverClass = config.popoverClass;
  10295. this.openDelay = config.openDelay;
  10296. this.closeDelay = config.closeDelay;
  10297. this._popupService = new PopupService(NgbPopoverWindow, injector, viewContainerRef, _renderer, componentFactoryResolver, applicationRef);
  10298. this._zoneSubscription = _ngZone.onStable.subscribe((/**
  10299. * @return {?}
  10300. */
  10301. function () {
  10302. if (_this._windowRef) {
  10303. positionElements(_this._elementRef.nativeElement, _this._windowRef.location.nativeElement, _this.placement, _this.container === 'body', 'bs-popover');
  10304. }
  10305. }));
  10306. }
  10307. /**
  10308. * @private
  10309. * @return {?}
  10310. */
  10311. NgbPopover.prototype._isDisabled = /**
  10312. * @private
  10313. * @return {?}
  10314. */
  10315. function () {
  10316. if (this.disablePopover) {
  10317. return true;
  10318. }
  10319. if (!this.ngbPopover && !this.popoverTitle) {
  10320. return true;
  10321. }
  10322. return false;
  10323. };
  10324. /**
  10325. * Opens the popover.
  10326. *
  10327. * This is considered to be a "manual" triggering.
  10328. * The `context` is an optional value to be injected into the popover template when it is created.
  10329. */
  10330. /**
  10331. * Opens the popover.
  10332. *
  10333. * This is considered to be a "manual" triggering.
  10334. * The `context` is an optional value to be injected into the popover template when it is created.
  10335. * @param {?=} context
  10336. * @return {?}
  10337. */
  10338. NgbPopover.prototype.open = /**
  10339. * Opens the popover.
  10340. *
  10341. * This is considered to be a "manual" triggering.
  10342. * The `context` is an optional value to be injected into the popover template when it is created.
  10343. * @param {?=} context
  10344. * @return {?}
  10345. */
  10346. function (context) {
  10347. var _this = this;
  10348. if (!this._windowRef && !this._isDisabled()) {
  10349. this._windowRef = this._popupService.open(this.ngbPopover, context);
  10350. this._windowRef.instance.title = this.popoverTitle;
  10351. this._windowRef.instance.context = context;
  10352. this._windowRef.instance.popoverClass = this.popoverClass;
  10353. this._windowRef.instance.id = this._ngbPopoverWindowId;
  10354. this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', this._ngbPopoverWindowId);
  10355. if (this.container === 'body') {
  10356. this._document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement);
  10357. }
  10358. // We need to detect changes, because we don't know where .open() might be called from.
  10359. // Ex. opening popover from one of lifecycle hooks that run after the CD
  10360. // (say from ngAfterViewInit) will result in 'ExpressionHasChanged' exception
  10361. this._windowRef.changeDetectorRef.detectChanges();
  10362. // We need to mark for check, because popover won't work inside the OnPush component.
  10363. // Ex. when we use expression like `{{ popover.isOpen() : 'opened' : 'closed' }}`
  10364. // inside the template of an OnPush component and we change the popover from
  10365. // open -> closed, the expression in question won't be updated unless we explicitly
  10366. // mark the parent component to be checked.
  10367. this._windowRef.changeDetectorRef.markForCheck();
  10368. ngbAutoClose(this._ngZone, this._document, this.autoClose, (/**
  10369. * @return {?}
  10370. */
  10371. function () { return _this.close(); }), this.hidden, [this._windowRef.location.nativeElement]);
  10372. this.shown.emit();
  10373. }
  10374. };
  10375. /**
  10376. * Closes the popover.
  10377. *
  10378. * This is considered to be a "manual" triggering of the popover.
  10379. */
  10380. /**
  10381. * Closes the popover.
  10382. *
  10383. * This is considered to be a "manual" triggering of the popover.
  10384. * @return {?}
  10385. */
  10386. NgbPopover.prototype.close = /**
  10387. * Closes the popover.
  10388. *
  10389. * This is considered to be a "manual" triggering of the popover.
  10390. * @return {?}
  10391. */
  10392. function () {
  10393. if (this._windowRef) {
  10394. this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
  10395. this._popupService.close();
  10396. this._windowRef = null;
  10397. this.hidden.emit();
  10398. this._changeDetector.markForCheck();
  10399. }
  10400. };
  10401. /**
  10402. * Toggles the popover.
  10403. *
  10404. * This is considered to be a "manual" triggering of the popover.
  10405. */
  10406. /**
  10407. * Toggles the popover.
  10408. *
  10409. * This is considered to be a "manual" triggering of the popover.
  10410. * @return {?}
  10411. */
  10412. NgbPopover.prototype.toggle = /**
  10413. * Toggles the popover.
  10414. *
  10415. * This is considered to be a "manual" triggering of the popover.
  10416. * @return {?}
  10417. */
  10418. function () {
  10419. if (this._windowRef) {
  10420. this.close();
  10421. }
  10422. else {
  10423. this.open();
  10424. }
  10425. };
  10426. /**
  10427. * Returns `true`, if the popover is currently shown.
  10428. */
  10429. /**
  10430. * Returns `true`, if the popover is currently shown.
  10431. * @return {?}
  10432. */
  10433. NgbPopover.prototype.isOpen = /**
  10434. * Returns `true`, if the popover is currently shown.
  10435. * @return {?}
  10436. */
  10437. function () { return this._windowRef != null; };
  10438. /**
  10439. * @return {?}
  10440. */
  10441. NgbPopover.prototype.ngOnInit = /**
  10442. * @return {?}
  10443. */
  10444. function () {
  10445. this._unregisterListenersFn = listenToTriggers(this._renderer, this._elementRef.nativeElement, this.triggers, this.isOpen.bind(this), this.open.bind(this), this.close.bind(this), +this.openDelay, +this.closeDelay);
  10446. };
  10447. /**
  10448. * @param {?} __0
  10449. * @return {?}
  10450. */
  10451. NgbPopover.prototype.ngOnChanges = /**
  10452. * @param {?} __0
  10453. * @return {?}
  10454. */
  10455. function (_a) {
  10456. var ngbPopover = _a.ngbPopover, popoverTitle = _a.popoverTitle, disablePopover = _a.disablePopover, popoverClass = _a.popoverClass;
  10457. if (popoverClass && this.isOpen()) {
  10458. this._windowRef.instance.popoverClass = popoverClass.currentValue;
  10459. }
  10460. // close popover if title and content become empty, or disablePopover set to true
  10461. if ((ngbPopover || popoverTitle || disablePopover) && this._isDisabled()) {
  10462. this.close();
  10463. }
  10464. };
  10465. /**
  10466. * @return {?}
  10467. */
  10468. NgbPopover.prototype.ngOnDestroy = /**
  10469. * @return {?}
  10470. */
  10471. function () {
  10472. this.close();
  10473. // This check is needed as it might happen that ngOnDestroy is called before ngOnInit
  10474. // under certain conditions, see: https://github.com/ng-bootstrap/ng-bootstrap/issues/2199
  10475. if (this._unregisterListenersFn) {
  10476. this._unregisterListenersFn();
  10477. }
  10478. this._zoneSubscription.unsubscribe();
  10479. };
  10480. NgbPopover.decorators = [
  10481. { type: core.Directive, args: [{ selector: '[ngbPopover]', exportAs: 'ngbPopover' },] }
  10482. ];
  10483. /** @nocollapse */
  10484. NgbPopover.ctorParameters = function () { return [
  10485. { type: core.ElementRef },
  10486. { type: core.Renderer2 },
  10487. { type: core.Injector },
  10488. { type: core.ComponentFactoryResolver },
  10489. { type: core.ViewContainerRef },
  10490. { type: NgbPopoverConfig },
  10491. { type: core.NgZone },
  10492. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  10493. { type: core.ChangeDetectorRef },
  10494. { type: core.ApplicationRef }
  10495. ]; };
  10496. NgbPopover.propDecorators = {
  10497. autoClose: [{ type: core.Input }],
  10498. ngbPopover: [{ type: core.Input }],
  10499. popoverTitle: [{ type: core.Input }],
  10500. placement: [{ type: core.Input }],
  10501. triggers: [{ type: core.Input }],
  10502. container: [{ type: core.Input }],
  10503. disablePopover: [{ type: core.Input }],
  10504. popoverClass: [{ type: core.Input }],
  10505. openDelay: [{ type: core.Input }],
  10506. closeDelay: [{ type: core.Input }],
  10507. shown: [{ type: core.Output }],
  10508. hidden: [{ type: core.Output }]
  10509. };
  10510. return NgbPopover;
  10511. }());
  10512. /**
  10513. * @fileoverview added by tsickle
  10514. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10515. */
  10516. var NgbPopoverModule = /** @class */ (function () {
  10517. function NgbPopoverModule() {
  10518. }
  10519. NgbPopoverModule.decorators = [
  10520. { type: core.NgModule, args: [{
  10521. declarations: [NgbPopover, NgbPopoverWindow],
  10522. exports: [NgbPopover],
  10523. imports: [common.CommonModule],
  10524. entryComponents: [NgbPopoverWindow]
  10525. },] }
  10526. ];
  10527. return NgbPopoverModule;
  10528. }());
  10529. /**
  10530. * @fileoverview added by tsickle
  10531. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10532. */
  10533. /**
  10534. * A configuration service for the [`NgbProgressbar`](#/components/progressbar/api#NgbProgressbar) component.
  10535. *
  10536. * You can inject this service, typically in your root component, and customize the values of its properties in
  10537. * order to provide default values for all the progress bars used in the application.
  10538. */
  10539. var NgbProgressbarConfig = /** @class */ (function () {
  10540. function NgbProgressbarConfig() {
  10541. this.max = 100;
  10542. this.animated = false;
  10543. this.striped = false;
  10544. this.showValue = false;
  10545. }
  10546. NgbProgressbarConfig.decorators = [
  10547. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  10548. ];
  10549. /** @nocollapse */ NgbProgressbarConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbProgressbarConfig_Factory() { return new NgbProgressbarConfig(); }, token: NgbProgressbarConfig, providedIn: "root" });
  10550. return NgbProgressbarConfig;
  10551. }());
  10552. /**
  10553. * @fileoverview added by tsickle
  10554. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10555. */
  10556. /**
  10557. * A directive that provides feedback on the progress of a workflow or an action.
  10558. */
  10559. var NgbProgressbar = /** @class */ (function () {
  10560. function NgbProgressbar(config) {
  10561. /**
  10562. * The current value for the progress bar.
  10563. *
  10564. * Should be in the `[0, max]` range.
  10565. */
  10566. this.value = 0;
  10567. this.max = config.max;
  10568. this.animated = config.animated;
  10569. this.striped = config.striped;
  10570. this.textType = config.textType;
  10571. this.type = config.type;
  10572. this.showValue = config.showValue;
  10573. this.height = config.height;
  10574. }
  10575. Object.defineProperty(NgbProgressbar.prototype, "max", {
  10576. get: /**
  10577. * @return {?}
  10578. */
  10579. function () { return this._max; },
  10580. /**
  10581. * The maximal value to be displayed in the progress bar.
  10582. *
  10583. * Should be a positive number. Will default to 100 otherwise.
  10584. */
  10585. set: /**
  10586. * The maximal value to be displayed in the progress bar.
  10587. *
  10588. * Should be a positive number. Will default to 100 otherwise.
  10589. * @param {?} max
  10590. * @return {?}
  10591. */
  10592. function (max) {
  10593. this._max = !isNumber(max) || max <= 0 ? 100 : max;
  10594. },
  10595. enumerable: true,
  10596. configurable: true
  10597. });
  10598. /**
  10599. * @return {?}
  10600. */
  10601. NgbProgressbar.prototype.getValue = /**
  10602. * @return {?}
  10603. */
  10604. function () { return getValueInRange(this.value, this.max); };
  10605. /**
  10606. * @return {?}
  10607. */
  10608. NgbProgressbar.prototype.getPercentValue = /**
  10609. * @return {?}
  10610. */
  10611. function () { return 100 * this.getValue() / this.max; };
  10612. NgbProgressbar.decorators = [
  10613. { type: core.Component, args: [{
  10614. selector: 'ngb-progressbar',
  10615. changeDetection: core.ChangeDetectionStrategy.OnPush,
  10616. encapsulation: core.ViewEncapsulation.None,
  10617. template: "\n <div class=\"progress\" [style.height]=\"height\">\n <div class=\"progress-bar{{type ? ' bg-' + type : ''}}{{textType ? ' text-' + textType : ''}}\n {{animated ? ' progress-bar-animated' : ''}}{{striped ? ' progress-bar-striped' : ''}}\" role=\"progressbar\" [style.width.%]=\"getPercentValue()\"\n [attr.aria-valuenow]=\"getValue()\" aria-valuemin=\"0\" [attr.aria-valuemax]=\"max\">\n <span *ngIf=\"showValue\" i18n=\"@@ngb.progressbar.value\">{{getPercentValue()}}%</span><ng-content></ng-content>\n </div>\n </div>\n "
  10618. }] }
  10619. ];
  10620. /** @nocollapse */
  10621. NgbProgressbar.ctorParameters = function () { return [
  10622. { type: NgbProgressbarConfig }
  10623. ]; };
  10624. NgbProgressbar.propDecorators = {
  10625. max: [{ type: core.Input }],
  10626. animated: [{ type: core.Input }],
  10627. striped: [{ type: core.Input }],
  10628. showValue: [{ type: core.Input }],
  10629. textType: [{ type: core.Input }],
  10630. type: [{ type: core.Input }],
  10631. value: [{ type: core.Input }],
  10632. height: [{ type: core.Input }]
  10633. };
  10634. return NgbProgressbar;
  10635. }());
  10636. /**
  10637. * @fileoverview added by tsickle
  10638. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10639. */
  10640. var NgbProgressbarModule = /** @class */ (function () {
  10641. function NgbProgressbarModule() {
  10642. }
  10643. NgbProgressbarModule.decorators = [
  10644. { type: core.NgModule, args: [{ declarations: [NgbProgressbar], exports: [NgbProgressbar], imports: [common.CommonModule] },] }
  10645. ];
  10646. return NgbProgressbarModule;
  10647. }());
  10648. /**
  10649. * @fileoverview added by tsickle
  10650. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10651. */
  10652. /**
  10653. * A configuration service for the [`NgbRating`](#/components/rating/api#NgbRating) component.
  10654. *
  10655. * You can inject this service, typically in your root component, and customize the values of its properties in
  10656. * order to provide default values for all the ratings used in the application.
  10657. */
  10658. var NgbRatingConfig = /** @class */ (function () {
  10659. function NgbRatingConfig() {
  10660. this.max = 10;
  10661. this.readonly = false;
  10662. this.resettable = false;
  10663. }
  10664. NgbRatingConfig.decorators = [
  10665. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  10666. ];
  10667. /** @nocollapse */ NgbRatingConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbRatingConfig_Factory() { return new NgbRatingConfig(); }, token: NgbRatingConfig, providedIn: "root" });
  10668. return NgbRatingConfig;
  10669. }());
  10670. /**
  10671. * @fileoverview added by tsickle
  10672. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10673. */
  10674. /** @type {?} */
  10675. var NGB_RATING_VALUE_ACCESSOR = {
  10676. provide: forms.NG_VALUE_ACCESSOR,
  10677. useExisting: core.forwardRef((/**
  10678. * @return {?}
  10679. */
  10680. function () { return NgbRating; })),
  10681. multi: true
  10682. };
  10683. /**
  10684. * A directive that helps visualising and interacting with a star rating bar.
  10685. */
  10686. var NgbRating = /** @class */ (function () {
  10687. function NgbRating(config, _changeDetectorRef) {
  10688. this._changeDetectorRef = _changeDetectorRef;
  10689. this.contexts = [];
  10690. this.disabled = false;
  10691. /**
  10692. * An event emitted when the user is hovering over a given rating.
  10693. *
  10694. * Event payload equals to the rating being hovered over.
  10695. */
  10696. this.hover = new core.EventEmitter();
  10697. /**
  10698. * An event emitted when the user stops hovering over a given rating.
  10699. *
  10700. * Event payload equals to the rating of the last item being hovered over.
  10701. */
  10702. this.leave = new core.EventEmitter();
  10703. /**
  10704. * An event emitted when the user selects a new rating.
  10705. *
  10706. * Event payload equals to the newly selected rating.
  10707. */
  10708. this.rateChange = new core.EventEmitter(true);
  10709. this.onChange = (/**
  10710. * @param {?} _
  10711. * @return {?}
  10712. */
  10713. function (_) { });
  10714. this.onTouched = (/**
  10715. * @return {?}
  10716. */
  10717. function () { });
  10718. this.max = config.max;
  10719. this.readonly = config.readonly;
  10720. }
  10721. /**
  10722. * @return {?}
  10723. */
  10724. NgbRating.prototype.ariaValueText = /**
  10725. * @return {?}
  10726. */
  10727. function () { return this.nextRate + " out of " + this.max; };
  10728. /**
  10729. * @param {?} value
  10730. * @return {?}
  10731. */
  10732. NgbRating.prototype.enter = /**
  10733. * @param {?} value
  10734. * @return {?}
  10735. */
  10736. function (value) {
  10737. if (!this.readonly && !this.disabled) {
  10738. this._updateState(value);
  10739. }
  10740. this.hover.emit(value);
  10741. };
  10742. /**
  10743. * @return {?}
  10744. */
  10745. NgbRating.prototype.handleBlur = /**
  10746. * @return {?}
  10747. */
  10748. function () { this.onTouched(); };
  10749. /**
  10750. * @param {?} value
  10751. * @return {?}
  10752. */
  10753. NgbRating.prototype.handleClick = /**
  10754. * @param {?} value
  10755. * @return {?}
  10756. */
  10757. function (value) { this.update(this.resettable && this.rate === value ? 0 : value); };
  10758. /**
  10759. * @param {?} event
  10760. * @return {?}
  10761. */
  10762. NgbRating.prototype.handleKeyDown = /**
  10763. * @param {?} event
  10764. * @return {?}
  10765. */
  10766. function (event) {
  10767. // tslint:disable-next-line:deprecation
  10768. switch (event.which) {
  10769. case Key.ArrowDown:
  10770. case Key.ArrowLeft:
  10771. this.update(this.rate - 1);
  10772. break;
  10773. case Key.ArrowUp:
  10774. case Key.ArrowRight:
  10775. this.update(this.rate + 1);
  10776. break;
  10777. case Key.Home:
  10778. this.update(0);
  10779. break;
  10780. case Key.End:
  10781. this.update(this.max);
  10782. break;
  10783. default:
  10784. return;
  10785. }
  10786. // note 'return' in default case
  10787. event.preventDefault();
  10788. };
  10789. /**
  10790. * @param {?} changes
  10791. * @return {?}
  10792. */
  10793. NgbRating.prototype.ngOnChanges = /**
  10794. * @param {?} changes
  10795. * @return {?}
  10796. */
  10797. function (changes) {
  10798. if (changes['rate']) {
  10799. this.update(this.rate);
  10800. }
  10801. };
  10802. /**
  10803. * @return {?}
  10804. */
  10805. NgbRating.prototype.ngOnInit = /**
  10806. * @return {?}
  10807. */
  10808. function () {
  10809. this.contexts = Array.from({ length: this.max }, (/**
  10810. * @param {?} v
  10811. * @param {?} k
  10812. * @return {?}
  10813. */
  10814. function (v, k) { return ({ fill: 0, index: k }); }));
  10815. this._updateState(this.rate);
  10816. };
  10817. /**
  10818. * @param {?} fn
  10819. * @return {?}
  10820. */
  10821. NgbRating.prototype.registerOnChange = /**
  10822. * @param {?} fn
  10823. * @return {?}
  10824. */
  10825. function (fn) { this.onChange = fn; };
  10826. /**
  10827. * @param {?} fn
  10828. * @return {?}
  10829. */
  10830. NgbRating.prototype.registerOnTouched = /**
  10831. * @param {?} fn
  10832. * @return {?}
  10833. */
  10834. function (fn) { this.onTouched = fn; };
  10835. /**
  10836. * @return {?}
  10837. */
  10838. NgbRating.prototype.reset = /**
  10839. * @return {?}
  10840. */
  10841. function () {
  10842. this.leave.emit(this.nextRate);
  10843. this._updateState(this.rate);
  10844. };
  10845. /**
  10846. * @param {?} isDisabled
  10847. * @return {?}
  10848. */
  10849. NgbRating.prototype.setDisabledState = /**
  10850. * @param {?} isDisabled
  10851. * @return {?}
  10852. */
  10853. function (isDisabled) { this.disabled = isDisabled; };
  10854. /**
  10855. * @param {?} value
  10856. * @param {?=} internalChange
  10857. * @return {?}
  10858. */
  10859. NgbRating.prototype.update = /**
  10860. * @param {?} value
  10861. * @param {?=} internalChange
  10862. * @return {?}
  10863. */
  10864. function (value, internalChange) {
  10865. if (internalChange === void 0) { internalChange = true; }
  10866. /** @type {?} */
  10867. var newRate = getValueInRange(value, this.max, 0);
  10868. if (!this.readonly && !this.disabled && this.rate !== newRate) {
  10869. this.rate = newRate;
  10870. this.rateChange.emit(this.rate);
  10871. }
  10872. if (internalChange) {
  10873. this.onChange(this.rate);
  10874. this.onTouched();
  10875. }
  10876. this._updateState(this.rate);
  10877. };
  10878. /**
  10879. * @param {?} value
  10880. * @return {?}
  10881. */
  10882. NgbRating.prototype.writeValue = /**
  10883. * @param {?} value
  10884. * @return {?}
  10885. */
  10886. function (value) {
  10887. this.update(value, false);
  10888. this._changeDetectorRef.markForCheck();
  10889. };
  10890. /**
  10891. * @private
  10892. * @param {?} index
  10893. * @return {?}
  10894. */
  10895. NgbRating.prototype._getFillValue = /**
  10896. * @private
  10897. * @param {?} index
  10898. * @return {?}
  10899. */
  10900. function (index) {
  10901. /** @type {?} */
  10902. var diff = this.nextRate - index;
  10903. if (diff >= 1) {
  10904. return 100;
  10905. }
  10906. if (diff < 1 && diff > 0) {
  10907. return parseInt((diff * 100).toFixed(2), 10);
  10908. }
  10909. return 0;
  10910. };
  10911. /**
  10912. * @private
  10913. * @param {?} nextValue
  10914. * @return {?}
  10915. */
  10916. NgbRating.prototype._updateState = /**
  10917. * @private
  10918. * @param {?} nextValue
  10919. * @return {?}
  10920. */
  10921. function (nextValue) {
  10922. var _this = this;
  10923. this.nextRate = nextValue;
  10924. this.contexts.forEach((/**
  10925. * @param {?} context
  10926. * @param {?} index
  10927. * @return {?}
  10928. */
  10929. function (context, index) { return context.fill = _this._getFillValue(index); }));
  10930. };
  10931. NgbRating.decorators = [
  10932. { type: core.Component, args: [{
  10933. selector: 'ngb-rating',
  10934. changeDetection: core.ChangeDetectionStrategy.OnPush,
  10935. encapsulation: core.ViewEncapsulation.None,
  10936. host: {
  10937. 'class': 'd-inline-flex',
  10938. 'tabindex': '0',
  10939. 'role': 'slider',
  10940. 'aria-valuemin': '0',
  10941. '[attr.aria-valuemax]': 'max',
  10942. '[attr.aria-valuenow]': 'nextRate',
  10943. '[attr.aria-valuetext]': 'ariaValueText()',
  10944. '[attr.aria-disabled]': 'readonly ? true : null',
  10945. '(blur)': 'handleBlur()',
  10946. '(keydown)': 'handleKeyDown($event)',
  10947. '(mouseleave)': 'reset()'
  10948. },
  10949. template: "\n <ng-template #t let-fill=\"fill\">{{ fill === 100 ? '&#9733;' : '&#9734;' }}</ng-template>\n <ng-template ngFor [ngForOf]=\"contexts\" let-index=\"index\">\n <span class=\"sr-only\">({{ index < nextRate ? '*' : ' ' }})</span>\n <span (mouseenter)=\"enter(index + 1)\" (click)=\"handleClick(index + 1)\" [style.cursor]=\"readonly || disabled ? 'default' : 'pointer'\">\n <ng-template [ngTemplateOutlet]=\"starTemplate || starTemplateFromContent || t\" [ngTemplateOutletContext]=\"contexts[index]\">\n </ng-template>\n </span>\n </ng-template>\n ",
  10950. providers: [NGB_RATING_VALUE_ACCESSOR]
  10951. }] }
  10952. ];
  10953. /** @nocollapse */
  10954. NgbRating.ctorParameters = function () { return [
  10955. { type: NgbRatingConfig },
  10956. { type: core.ChangeDetectorRef }
  10957. ]; };
  10958. NgbRating.propDecorators = {
  10959. max: [{ type: core.Input }],
  10960. rate: [{ type: core.Input }],
  10961. readonly: [{ type: core.Input }],
  10962. resettable: [{ type: core.Input }],
  10963. starTemplate: [{ type: core.Input }],
  10964. starTemplateFromContent: [{ type: core.ContentChild, args: [core.TemplateRef, { static: false },] }],
  10965. hover: [{ type: core.Output }],
  10966. leave: [{ type: core.Output }],
  10967. rateChange: [{ type: core.Output }]
  10968. };
  10969. return NgbRating;
  10970. }());
  10971. /**
  10972. * @fileoverview added by tsickle
  10973. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10974. */
  10975. var NgbRatingModule = /** @class */ (function () {
  10976. function NgbRatingModule() {
  10977. }
  10978. NgbRatingModule.decorators = [
  10979. { type: core.NgModule, args: [{ declarations: [NgbRating], exports: [NgbRating], imports: [common.CommonModule] },] }
  10980. ];
  10981. return NgbRatingModule;
  10982. }());
  10983. /**
  10984. * @fileoverview added by tsickle
  10985. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  10986. */
  10987. /**
  10988. * A configuration service for the [`NgbTabset`](#/components/tabset/api#NgbTabset) component.
  10989. *
  10990. * You can inject this service, typically in your root component, and customize the values of its properties in
  10991. * order to provide default values for all the tabsets used in the application.
  10992. */
  10993. var NgbTabsetConfig = /** @class */ (function () {
  10994. function NgbTabsetConfig() {
  10995. this.justify = 'start';
  10996. this.orientation = 'horizontal';
  10997. this.type = 'tabs';
  10998. }
  10999. NgbTabsetConfig.decorators = [
  11000. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  11001. ];
  11002. /** @nocollapse */ NgbTabsetConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbTabsetConfig_Factory() { return new NgbTabsetConfig(); }, token: NgbTabsetConfig, providedIn: "root" });
  11003. return NgbTabsetConfig;
  11004. }());
  11005. /**
  11006. * @fileoverview added by tsickle
  11007. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11008. */
  11009. /** @type {?} */
  11010. var nextId$4 = 0;
  11011. /**
  11012. * A directive to wrap tab titles that need to contain HTML markup or other directives.
  11013. *
  11014. * Alternatively you could use the `NgbTab.title` input for string titles.
  11015. */
  11016. var NgbTabTitle = /** @class */ (function () {
  11017. function NgbTabTitle(templateRef) {
  11018. this.templateRef = templateRef;
  11019. }
  11020. NgbTabTitle.decorators = [
  11021. { type: core.Directive, args: [{ selector: 'ng-template[ngbTabTitle]' },] }
  11022. ];
  11023. /** @nocollapse */
  11024. NgbTabTitle.ctorParameters = function () { return [
  11025. { type: core.TemplateRef }
  11026. ]; };
  11027. return NgbTabTitle;
  11028. }());
  11029. /**
  11030. * A directive to wrap content to be displayed in a tab.
  11031. */
  11032. var NgbTabContent = /** @class */ (function () {
  11033. function NgbTabContent(templateRef) {
  11034. this.templateRef = templateRef;
  11035. }
  11036. NgbTabContent.decorators = [
  11037. { type: core.Directive, args: [{ selector: 'ng-template[ngbTabContent]' },] }
  11038. ];
  11039. /** @nocollapse */
  11040. NgbTabContent.ctorParameters = function () { return [
  11041. { type: core.TemplateRef }
  11042. ]; };
  11043. return NgbTabContent;
  11044. }());
  11045. /**
  11046. * A directive representing an individual tab.
  11047. */
  11048. var NgbTab = /** @class */ (function () {
  11049. function NgbTab() {
  11050. /**
  11051. * The tab identifier.
  11052. *
  11053. * Must be unique for the entire document for proper accessibility support.
  11054. */
  11055. this.id = "ngb-tab-" + nextId$4++;
  11056. /**
  11057. * If `true`, the current tab is disabled and can't be toggled.
  11058. */
  11059. this.disabled = false;
  11060. }
  11061. /**
  11062. * @return {?}
  11063. */
  11064. NgbTab.prototype.ngAfterContentChecked = /**
  11065. * @return {?}
  11066. */
  11067. function () {
  11068. // We are using @ContentChildren instead of @ContentChild as in the Angular version being used
  11069. // only @ContentChildren allows us to specify the {descendants: false} option.
  11070. // Without {descendants: false} we are hitting bugs described in:
  11071. // https://github.com/ng-bootstrap/ng-bootstrap/issues/2240
  11072. this.titleTpl = this.titleTpls.first;
  11073. this.contentTpl = this.contentTpls.first;
  11074. };
  11075. NgbTab.decorators = [
  11076. { type: core.Directive, args: [{ selector: 'ngb-tab' },] }
  11077. ];
  11078. NgbTab.propDecorators = {
  11079. id: [{ type: core.Input }],
  11080. title: [{ type: core.Input }],
  11081. disabled: [{ type: core.Input }],
  11082. titleTpls: [{ type: core.ContentChildren, args: [NgbTabTitle, { descendants: false },] }],
  11083. contentTpls: [{ type: core.ContentChildren, args: [NgbTabContent, { descendants: false },] }]
  11084. };
  11085. return NgbTab;
  11086. }());
  11087. /**
  11088. * A component that makes it easy to create tabbed interface.
  11089. */
  11090. var NgbTabset = /** @class */ (function () {
  11091. function NgbTabset(config) {
  11092. /**
  11093. * If `true`, non-visible tabs content will be removed from DOM. Otherwise it will just be hidden.
  11094. */
  11095. this.destroyOnHide = true;
  11096. /**
  11097. * A tab change event emitted right before the tab change happens.
  11098. *
  11099. * See [`NgbTabChangeEvent`](#/components/tabset/api#NgbTabChangeEvent) for payload details.
  11100. */
  11101. this.tabChange = new core.EventEmitter();
  11102. this.type = config.type;
  11103. this.justify = config.justify;
  11104. this.orientation = config.orientation;
  11105. }
  11106. Object.defineProperty(NgbTabset.prototype, "justify", {
  11107. /**
  11108. * The horizontal alignment of the tabs with flexbox utilities.
  11109. */
  11110. set: /**
  11111. * The horizontal alignment of the tabs with flexbox utilities.
  11112. * @param {?} className
  11113. * @return {?}
  11114. */
  11115. function (className) {
  11116. if (className === 'fill' || className === 'justified') {
  11117. this.justifyClass = "nav-" + className;
  11118. }
  11119. else {
  11120. this.justifyClass = "justify-content-" + className;
  11121. }
  11122. },
  11123. enumerable: true,
  11124. configurable: true
  11125. });
  11126. /**
  11127. * Selects the tab with the given id and shows its associated content panel.
  11128. *
  11129. * Any other tab that was previously selected becomes unselected and its associated pane is removed from DOM or
  11130. * hidden depending on the `destroyOnHide` value.
  11131. */
  11132. /**
  11133. * Selects the tab with the given id and shows its associated content panel.
  11134. *
  11135. * Any other tab that was previously selected becomes unselected and its associated pane is removed from DOM or
  11136. * hidden depending on the `destroyOnHide` value.
  11137. * @param {?} tabId
  11138. * @return {?}
  11139. */
  11140. NgbTabset.prototype.select = /**
  11141. * Selects the tab with the given id and shows its associated content panel.
  11142. *
  11143. * Any other tab that was previously selected becomes unselected and its associated pane is removed from DOM or
  11144. * hidden depending on the `destroyOnHide` value.
  11145. * @param {?} tabId
  11146. * @return {?}
  11147. */
  11148. function (tabId) {
  11149. /** @type {?} */
  11150. var selectedTab = this._getTabById(tabId);
  11151. if (selectedTab && !selectedTab.disabled && this.activeId !== selectedTab.id) {
  11152. /** @type {?} */
  11153. var defaultPrevented_1 = false;
  11154. this.tabChange.emit({ activeId: this.activeId, nextId: selectedTab.id, preventDefault: (/**
  11155. * @return {?}
  11156. */
  11157. function () { defaultPrevented_1 = true; }) });
  11158. if (!defaultPrevented_1) {
  11159. this.activeId = selectedTab.id;
  11160. }
  11161. }
  11162. };
  11163. /**
  11164. * @return {?}
  11165. */
  11166. NgbTabset.prototype.ngAfterContentChecked = /**
  11167. * @return {?}
  11168. */
  11169. function () {
  11170. // auto-correct activeId that might have been set incorrectly as input
  11171. /** @type {?} */
  11172. var activeTab = this._getTabById(this.activeId);
  11173. this.activeId = activeTab ? activeTab.id : (this.tabs.length ? this.tabs.first.id : null);
  11174. };
  11175. /**
  11176. * @private
  11177. * @param {?} id
  11178. * @return {?}
  11179. */
  11180. NgbTabset.prototype._getTabById = /**
  11181. * @private
  11182. * @param {?} id
  11183. * @return {?}
  11184. */
  11185. function (id) {
  11186. /** @type {?} */
  11187. var tabsWithId = this.tabs.filter((/**
  11188. * @param {?} tab
  11189. * @return {?}
  11190. */
  11191. function (tab) { return tab.id === id; }));
  11192. return tabsWithId.length ? tabsWithId[0] : null;
  11193. };
  11194. NgbTabset.decorators = [
  11195. { type: core.Component, args: [{
  11196. selector: 'ngb-tabset',
  11197. exportAs: 'ngbTabset',
  11198. encapsulation: core.ViewEncapsulation.None,
  11199. template: "\n <ul [class]=\"'nav nav-' + type + (orientation == 'horizontal'? ' ' + justifyClass : ' flex-column')\" role=\"tablist\">\n <li class=\"nav-item\" *ngFor=\"let tab of tabs\">\n <a [id]=\"tab.id\" class=\"nav-link\" [class.active]=\"tab.id === activeId\" [class.disabled]=\"tab.disabled\"\n href (click)=\"select(tab.id); $event.preventDefault()\" role=\"tab\" [attr.tabindex]=\"(tab.disabled ? '-1': undefined)\"\n [attr.aria-controls]=\"(!destroyOnHide || tab.id === activeId ? tab.id + '-panel' : null)\"\n [attr.aria-selected]=\"tab.id === activeId\" [attr.aria-disabled]=\"tab.disabled\">\n {{tab.title}}<ng-template [ngTemplateOutlet]=\"tab.titleTpl?.templateRef\"></ng-template>\n </a>\n </li>\n </ul>\n <div class=\"tab-content\">\n <ng-template ngFor let-tab [ngForOf]=\"tabs\">\n <div\n class=\"tab-pane {{tab.id === activeId ? 'active' : null}}\"\n *ngIf=\"!destroyOnHide || tab.id === activeId\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"tab.id\" id=\"{{tab.id}}-panel\">\n <ng-template [ngTemplateOutlet]=\"tab.contentTpl?.templateRef\"></ng-template>\n </div>\n </ng-template>\n </div>\n "
  11200. }] }
  11201. ];
  11202. /** @nocollapse */
  11203. NgbTabset.ctorParameters = function () { return [
  11204. { type: NgbTabsetConfig }
  11205. ]; };
  11206. NgbTabset.propDecorators = {
  11207. tabs: [{ type: core.ContentChildren, args: [NgbTab,] }],
  11208. activeId: [{ type: core.Input }],
  11209. destroyOnHide: [{ type: core.Input }],
  11210. justify: [{ type: core.Input }],
  11211. orientation: [{ type: core.Input }],
  11212. type: [{ type: core.Input }],
  11213. tabChange: [{ type: core.Output }]
  11214. };
  11215. return NgbTabset;
  11216. }());
  11217. /**
  11218. * @fileoverview added by tsickle
  11219. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11220. */
  11221. /** @type {?} */
  11222. var NGB_TABSET_DIRECTIVES = [NgbTabset, NgbTab, NgbTabContent, NgbTabTitle];
  11223. var NgbTabsetModule = /** @class */ (function () {
  11224. function NgbTabsetModule() {
  11225. }
  11226. NgbTabsetModule.decorators = [
  11227. { type: core.NgModule, args: [{ declarations: NGB_TABSET_DIRECTIVES, exports: NGB_TABSET_DIRECTIVES, imports: [common.CommonModule, NgbNavModule] },] }
  11228. ];
  11229. return NgbTabsetModule;
  11230. }());
  11231. /**
  11232. * @fileoverview added by tsickle
  11233. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11234. */
  11235. var NgbTime = /** @class */ (function () {
  11236. function NgbTime(hour, minute, second) {
  11237. this.hour = toInteger(hour);
  11238. this.minute = toInteger(minute);
  11239. this.second = toInteger(second);
  11240. }
  11241. /**
  11242. * @param {?=} step
  11243. * @return {?}
  11244. */
  11245. NgbTime.prototype.changeHour = /**
  11246. * @param {?=} step
  11247. * @return {?}
  11248. */
  11249. function (step) {
  11250. if (step === void 0) { step = 1; }
  11251. this.updateHour((isNaN(this.hour) ? 0 : this.hour) + step);
  11252. };
  11253. /**
  11254. * @param {?} hour
  11255. * @return {?}
  11256. */
  11257. NgbTime.prototype.updateHour = /**
  11258. * @param {?} hour
  11259. * @return {?}
  11260. */
  11261. function (hour) {
  11262. if (isNumber(hour)) {
  11263. this.hour = (hour < 0 ? 24 + hour : hour) % 24;
  11264. }
  11265. else {
  11266. this.hour = NaN;
  11267. }
  11268. };
  11269. /**
  11270. * @param {?=} step
  11271. * @return {?}
  11272. */
  11273. NgbTime.prototype.changeMinute = /**
  11274. * @param {?=} step
  11275. * @return {?}
  11276. */
  11277. function (step) {
  11278. if (step === void 0) { step = 1; }
  11279. this.updateMinute((isNaN(this.minute) ? 0 : this.minute) + step);
  11280. };
  11281. /**
  11282. * @param {?} minute
  11283. * @return {?}
  11284. */
  11285. NgbTime.prototype.updateMinute = /**
  11286. * @param {?} minute
  11287. * @return {?}
  11288. */
  11289. function (minute) {
  11290. if (isNumber(minute)) {
  11291. this.minute = minute % 60 < 0 ? 60 + minute % 60 : minute % 60;
  11292. this.changeHour(Math.floor(minute / 60));
  11293. }
  11294. else {
  11295. this.minute = NaN;
  11296. }
  11297. };
  11298. /**
  11299. * @param {?=} step
  11300. * @return {?}
  11301. */
  11302. NgbTime.prototype.changeSecond = /**
  11303. * @param {?=} step
  11304. * @return {?}
  11305. */
  11306. function (step) {
  11307. if (step === void 0) { step = 1; }
  11308. this.updateSecond((isNaN(this.second) ? 0 : this.second) + step);
  11309. };
  11310. /**
  11311. * @param {?} second
  11312. * @return {?}
  11313. */
  11314. NgbTime.prototype.updateSecond = /**
  11315. * @param {?} second
  11316. * @return {?}
  11317. */
  11318. function (second) {
  11319. if (isNumber(second)) {
  11320. this.second = second < 0 ? 60 + second % 60 : second % 60;
  11321. this.changeMinute(Math.floor(second / 60));
  11322. }
  11323. else {
  11324. this.second = NaN;
  11325. }
  11326. };
  11327. /**
  11328. * @param {?=} checkSecs
  11329. * @return {?}
  11330. */
  11331. NgbTime.prototype.isValid = /**
  11332. * @param {?=} checkSecs
  11333. * @return {?}
  11334. */
  11335. function (checkSecs) {
  11336. if (checkSecs === void 0) { checkSecs = true; }
  11337. return isNumber(this.hour) && isNumber(this.minute) && (checkSecs ? isNumber(this.second) : true);
  11338. };
  11339. /**
  11340. * @return {?}
  11341. */
  11342. NgbTime.prototype.toString = /**
  11343. * @return {?}
  11344. */
  11345. function () { return (this.hour || 0) + ":" + (this.minute || 0) + ":" + (this.second || 0); };
  11346. return NgbTime;
  11347. }());
  11348. /**
  11349. * @fileoverview added by tsickle
  11350. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11351. */
  11352. /**
  11353. * A configuration service for the [`NgbTimepicker`](#/components/timepicker/api#NgbTimepicker) component.
  11354. *
  11355. * You can inject this service, typically in your root component, and customize the values of its properties in
  11356. * order to provide default values for all the timepickers used in the application.
  11357. */
  11358. var NgbTimepickerConfig = /** @class */ (function () {
  11359. function NgbTimepickerConfig() {
  11360. this.meridian = false;
  11361. this.spinners = true;
  11362. this.seconds = false;
  11363. this.hourStep = 1;
  11364. this.minuteStep = 1;
  11365. this.secondStep = 1;
  11366. this.disabled = false;
  11367. this.readonlyInputs = false;
  11368. this.size = 'medium';
  11369. }
  11370. NgbTimepickerConfig.decorators = [
  11371. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  11372. ];
  11373. /** @nocollapse */ NgbTimepickerConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbTimepickerConfig_Factory() { return new NgbTimepickerConfig(); }, token: NgbTimepickerConfig, providedIn: "root" });
  11374. return NgbTimepickerConfig;
  11375. }());
  11376. /**
  11377. * @fileoverview added by tsickle
  11378. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11379. */
  11380. /**
  11381. * @return {?}
  11382. */
  11383. function NGB_DATEPICKER_TIME_ADAPTER_FACTORY() {
  11384. return new NgbTimeStructAdapter();
  11385. }
  11386. /**
  11387. * An abstract service that does the conversion between the internal timepicker `NgbTimeStruct` model and
  11388. * any provided user time model `T`, ex. a string, a native date, etc.
  11389. *
  11390. * The adapter is used **only** for conversion when binding timepicker to a form control,
  11391. * ex. `[(ngModel)]="userTimeModel"`. Here `userTimeModel` can be of any type.
  11392. *
  11393. * The default timepicker implementation assumes we use `NgbTimeStruct` as a user model.
  11394. *
  11395. * See the [custom time adapter demo](#/components/timepicker/examples#adapter) for an example.
  11396. *
  11397. * \@since 2.2.0
  11398. * @abstract
  11399. * @template T
  11400. */
  11401. var NgbTimeAdapter = /** @class */ (function () {
  11402. function NgbTimeAdapter() {
  11403. }
  11404. NgbTimeAdapter.decorators = [
  11405. { type: core.Injectable, args: [{ providedIn: 'root', useFactory: NGB_DATEPICKER_TIME_ADAPTER_FACTORY },] }
  11406. ];
  11407. /** @nocollapse */ NgbTimeAdapter.ngInjectableDef = core.ɵɵdefineInjectable({ factory: NGB_DATEPICKER_TIME_ADAPTER_FACTORY, token: NgbTimeAdapter, providedIn: "root" });
  11408. return NgbTimeAdapter;
  11409. }());
  11410. var NgbTimeStructAdapter = /** @class */ (function (_super) {
  11411. __extends(NgbTimeStructAdapter, _super);
  11412. function NgbTimeStructAdapter() {
  11413. return _super !== null && _super.apply(this, arguments) || this;
  11414. }
  11415. /**
  11416. * Converts a NgbTimeStruct value into NgbTimeStruct value
  11417. */
  11418. /**
  11419. * Converts a NgbTimeStruct value into NgbTimeStruct value
  11420. * @param {?} time
  11421. * @return {?}
  11422. */
  11423. NgbTimeStructAdapter.prototype.fromModel = /**
  11424. * Converts a NgbTimeStruct value into NgbTimeStruct value
  11425. * @param {?} time
  11426. * @return {?}
  11427. */
  11428. function (time) {
  11429. return (time && isInteger(time.hour) && isInteger(time.minute)) ?
  11430. { hour: time.hour, minute: time.minute, second: isInteger(time.second) ? time.second : null } :
  11431. null;
  11432. };
  11433. /**
  11434. * Converts a NgbTimeStruct value into NgbTimeStruct value
  11435. */
  11436. /**
  11437. * Converts a NgbTimeStruct value into NgbTimeStruct value
  11438. * @param {?} time
  11439. * @return {?}
  11440. */
  11441. NgbTimeStructAdapter.prototype.toModel = /**
  11442. * Converts a NgbTimeStruct value into NgbTimeStruct value
  11443. * @param {?} time
  11444. * @return {?}
  11445. */
  11446. function (time) {
  11447. return (time && isInteger(time.hour) && isInteger(time.minute)) ?
  11448. { hour: time.hour, minute: time.minute, second: isInteger(time.second) ? time.second : null } :
  11449. null;
  11450. };
  11451. NgbTimeStructAdapter.decorators = [
  11452. { type: core.Injectable }
  11453. ];
  11454. return NgbTimeStructAdapter;
  11455. }(NgbTimeAdapter));
  11456. /**
  11457. * @fileoverview added by tsickle
  11458. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11459. */
  11460. /**
  11461. * @param {?} locale
  11462. * @return {?}
  11463. */
  11464. function NGB_TIMEPICKER_I18N_FACTORY(locale) {
  11465. return new NgbTimepickerI18nDefault(locale);
  11466. }
  11467. /**
  11468. * Type of the service supplying day periods (for example, 'AM' and 'PM') to NgbTimepicker component.
  11469. * The default implementation of this service honors the Angular locale, and uses the registered locale data,
  11470. * as explained in the Angular i18n guide.
  11471. * @abstract
  11472. */
  11473. var NgbTimepickerI18n = /** @class */ (function () {
  11474. function NgbTimepickerI18n() {
  11475. }
  11476. NgbTimepickerI18n.decorators = [
  11477. { type: core.Injectable, args: [{ providedIn: 'root', useFactory: NGB_TIMEPICKER_I18N_FACTORY, deps: [core.LOCALE_ID] },] }
  11478. ];
  11479. /** @nocollapse */ NgbTimepickerI18n.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbTimepickerI18n_Factory() { return NGB_TIMEPICKER_I18N_FACTORY(core.ɵɵinject(core.LOCALE_ID)); }, token: NgbTimepickerI18n, providedIn: "root" });
  11480. return NgbTimepickerI18n;
  11481. }());
  11482. var NgbTimepickerI18nDefault = /** @class */ (function (_super) {
  11483. __extends(NgbTimepickerI18nDefault, _super);
  11484. function NgbTimepickerI18nDefault(locale) {
  11485. var _this = _super.call(this) || this;
  11486. _this._periods = common.getLocaleDayPeriods(locale, common.FormStyle.Standalone, common.TranslationWidth.Narrow);
  11487. return _this;
  11488. }
  11489. /**
  11490. * @return {?}
  11491. */
  11492. NgbTimepickerI18nDefault.prototype.getMorningPeriod = /**
  11493. * @return {?}
  11494. */
  11495. function () { return this._periods[0]; };
  11496. /**
  11497. * @return {?}
  11498. */
  11499. NgbTimepickerI18nDefault.prototype.getAfternoonPeriod = /**
  11500. * @return {?}
  11501. */
  11502. function () { return this._periods[1]; };
  11503. NgbTimepickerI18nDefault.decorators = [
  11504. { type: core.Injectable }
  11505. ];
  11506. /** @nocollapse */
  11507. NgbTimepickerI18nDefault.ctorParameters = function () { return [
  11508. { type: String, decorators: [{ type: core.Inject, args: [core.LOCALE_ID,] }] }
  11509. ]; };
  11510. return NgbTimepickerI18nDefault;
  11511. }(NgbTimepickerI18n));
  11512. /**
  11513. * @fileoverview added by tsickle
  11514. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11515. */
  11516. /** @type {?} */
  11517. var FILTER_REGEX = /[^0-9]/g;
  11518. /** @type {?} */
  11519. var NGB_TIMEPICKER_VALUE_ACCESSOR = {
  11520. provide: forms.NG_VALUE_ACCESSOR,
  11521. useExisting: core.forwardRef((/**
  11522. * @return {?}
  11523. */
  11524. function () { return NgbTimepicker; })),
  11525. multi: true
  11526. };
  11527. /**
  11528. * A directive that helps with wth picking hours, minutes and seconds.
  11529. */
  11530. var NgbTimepicker = /** @class */ (function () {
  11531. function NgbTimepicker(_config, _ngbTimeAdapter, _cd, i18n) {
  11532. this._config = _config;
  11533. this._ngbTimeAdapter = _ngbTimeAdapter;
  11534. this._cd = _cd;
  11535. this.i18n = i18n;
  11536. this.onChange = (/**
  11537. * @param {?} _
  11538. * @return {?}
  11539. */
  11540. function (_) { });
  11541. this.onTouched = (/**
  11542. * @return {?}
  11543. */
  11544. function () { });
  11545. this.meridian = _config.meridian;
  11546. this.spinners = _config.spinners;
  11547. this.seconds = _config.seconds;
  11548. this.hourStep = _config.hourStep;
  11549. this.minuteStep = _config.minuteStep;
  11550. this.secondStep = _config.secondStep;
  11551. this.disabled = _config.disabled;
  11552. this.readonlyInputs = _config.readonlyInputs;
  11553. this.size = _config.size;
  11554. }
  11555. Object.defineProperty(NgbTimepicker.prototype, "hourStep", {
  11556. get: /**
  11557. * @return {?}
  11558. */
  11559. function () { return this._hourStep; },
  11560. /**
  11561. * The number of hours to add/subtract when clicking hour spinners.
  11562. */
  11563. set: /**
  11564. * The number of hours to add/subtract when clicking hour spinners.
  11565. * @param {?} step
  11566. * @return {?}
  11567. */
  11568. function (step) {
  11569. this._hourStep = isInteger(step) ? step : this._config.hourStep;
  11570. },
  11571. enumerable: true,
  11572. configurable: true
  11573. });
  11574. Object.defineProperty(NgbTimepicker.prototype, "minuteStep", {
  11575. get: /**
  11576. * @return {?}
  11577. */
  11578. function () { return this._minuteStep; },
  11579. /**
  11580. * The number of minutes to add/subtract when clicking minute spinners.
  11581. */
  11582. set: /**
  11583. * The number of minutes to add/subtract when clicking minute spinners.
  11584. * @param {?} step
  11585. * @return {?}
  11586. */
  11587. function (step) {
  11588. this._minuteStep = isInteger(step) ? step : this._config.minuteStep;
  11589. },
  11590. enumerable: true,
  11591. configurable: true
  11592. });
  11593. Object.defineProperty(NgbTimepicker.prototype, "secondStep", {
  11594. get: /**
  11595. * @return {?}
  11596. */
  11597. function () { return this._secondStep; },
  11598. /**
  11599. * The number of seconds to add/subtract when clicking second spinners.
  11600. */
  11601. set: /**
  11602. * The number of seconds to add/subtract when clicking second spinners.
  11603. * @param {?} step
  11604. * @return {?}
  11605. */
  11606. function (step) {
  11607. this._secondStep = isInteger(step) ? step : this._config.secondStep;
  11608. },
  11609. enumerable: true,
  11610. configurable: true
  11611. });
  11612. /**
  11613. * @param {?} value
  11614. * @return {?}
  11615. */
  11616. NgbTimepicker.prototype.writeValue = /**
  11617. * @param {?} value
  11618. * @return {?}
  11619. */
  11620. function (value) {
  11621. /** @type {?} */
  11622. var structValue = this._ngbTimeAdapter.fromModel(value);
  11623. this.model = structValue ? new NgbTime(structValue.hour, structValue.minute, structValue.second) : new NgbTime();
  11624. if (!this.seconds && (!structValue || !isNumber(structValue.second))) {
  11625. this.model.second = 0;
  11626. }
  11627. this._cd.markForCheck();
  11628. };
  11629. /**
  11630. * @param {?} fn
  11631. * @return {?}
  11632. */
  11633. NgbTimepicker.prototype.registerOnChange = /**
  11634. * @param {?} fn
  11635. * @return {?}
  11636. */
  11637. function (fn) { this.onChange = fn; };
  11638. /**
  11639. * @param {?} fn
  11640. * @return {?}
  11641. */
  11642. NgbTimepicker.prototype.registerOnTouched = /**
  11643. * @param {?} fn
  11644. * @return {?}
  11645. */
  11646. function (fn) { this.onTouched = fn; };
  11647. /**
  11648. * @param {?} isDisabled
  11649. * @return {?}
  11650. */
  11651. NgbTimepicker.prototype.setDisabledState = /**
  11652. * @param {?} isDisabled
  11653. * @return {?}
  11654. */
  11655. function (isDisabled) { this.disabled = isDisabled; };
  11656. /**
  11657. * @param {?} step
  11658. * @return {?}
  11659. */
  11660. NgbTimepicker.prototype.changeHour = /**
  11661. * @param {?} step
  11662. * @return {?}
  11663. */
  11664. function (step) {
  11665. this.model.changeHour(step);
  11666. this.propagateModelChange();
  11667. };
  11668. /**
  11669. * @param {?} step
  11670. * @return {?}
  11671. */
  11672. NgbTimepicker.prototype.changeMinute = /**
  11673. * @param {?} step
  11674. * @return {?}
  11675. */
  11676. function (step) {
  11677. this.model.changeMinute(step);
  11678. this.propagateModelChange();
  11679. };
  11680. /**
  11681. * @param {?} step
  11682. * @return {?}
  11683. */
  11684. NgbTimepicker.prototype.changeSecond = /**
  11685. * @param {?} step
  11686. * @return {?}
  11687. */
  11688. function (step) {
  11689. this.model.changeSecond(step);
  11690. this.propagateModelChange();
  11691. };
  11692. /**
  11693. * @param {?} newVal
  11694. * @return {?}
  11695. */
  11696. NgbTimepicker.prototype.updateHour = /**
  11697. * @param {?} newVal
  11698. * @return {?}
  11699. */
  11700. function (newVal) {
  11701. /** @type {?} */
  11702. var isPM = this.model.hour >= 12;
  11703. /** @type {?} */
  11704. var enteredHour = toInteger(newVal);
  11705. if (this.meridian && (isPM && enteredHour < 12 || !isPM && enteredHour === 12)) {
  11706. this.model.updateHour(enteredHour + 12);
  11707. }
  11708. else {
  11709. this.model.updateHour(enteredHour);
  11710. }
  11711. this.propagateModelChange();
  11712. };
  11713. /**
  11714. * @param {?} newVal
  11715. * @return {?}
  11716. */
  11717. NgbTimepicker.prototype.updateMinute = /**
  11718. * @param {?} newVal
  11719. * @return {?}
  11720. */
  11721. function (newVal) {
  11722. this.model.updateMinute(toInteger(newVal));
  11723. this.propagateModelChange();
  11724. };
  11725. /**
  11726. * @param {?} newVal
  11727. * @return {?}
  11728. */
  11729. NgbTimepicker.prototype.updateSecond = /**
  11730. * @param {?} newVal
  11731. * @return {?}
  11732. */
  11733. function (newVal) {
  11734. this.model.updateSecond(toInteger(newVal));
  11735. this.propagateModelChange();
  11736. };
  11737. /**
  11738. * @return {?}
  11739. */
  11740. NgbTimepicker.prototype.toggleMeridian = /**
  11741. * @return {?}
  11742. */
  11743. function () {
  11744. if (this.meridian) {
  11745. this.changeHour(12);
  11746. }
  11747. };
  11748. /**
  11749. * @param {?} input
  11750. * @return {?}
  11751. */
  11752. NgbTimepicker.prototype.formatInput = /**
  11753. * @param {?} input
  11754. * @return {?}
  11755. */
  11756. function (input) { input.value = input.value.replace(FILTER_REGEX, ''); };
  11757. /**
  11758. * @param {?} value
  11759. * @return {?}
  11760. */
  11761. NgbTimepicker.prototype.formatHour = /**
  11762. * @param {?} value
  11763. * @return {?}
  11764. */
  11765. function (value) {
  11766. if (isNumber(value)) {
  11767. if (this.meridian) {
  11768. return padNumber(value % 12 === 0 ? 12 : value % 12);
  11769. }
  11770. else {
  11771. return padNumber(value % 24);
  11772. }
  11773. }
  11774. else {
  11775. return padNumber(NaN);
  11776. }
  11777. };
  11778. /**
  11779. * @param {?} value
  11780. * @return {?}
  11781. */
  11782. NgbTimepicker.prototype.formatMinSec = /**
  11783. * @param {?} value
  11784. * @return {?}
  11785. */
  11786. function (value) { return padNumber(value); };
  11787. Object.defineProperty(NgbTimepicker.prototype, "isSmallSize", {
  11788. get: /**
  11789. * @return {?}
  11790. */
  11791. function () { return this.size === 'small'; },
  11792. enumerable: true,
  11793. configurable: true
  11794. });
  11795. Object.defineProperty(NgbTimepicker.prototype, "isLargeSize", {
  11796. get: /**
  11797. * @return {?}
  11798. */
  11799. function () { return this.size === 'large'; },
  11800. enumerable: true,
  11801. configurable: true
  11802. });
  11803. /**
  11804. * @param {?} changes
  11805. * @return {?}
  11806. */
  11807. NgbTimepicker.prototype.ngOnChanges = /**
  11808. * @param {?} changes
  11809. * @return {?}
  11810. */
  11811. function (changes) {
  11812. if (changes['seconds'] && !this.seconds && this.model && !isNumber(this.model.second)) {
  11813. this.model.second = 0;
  11814. this.propagateModelChange(false);
  11815. }
  11816. };
  11817. /**
  11818. * @private
  11819. * @param {?=} touched
  11820. * @return {?}
  11821. */
  11822. NgbTimepicker.prototype.propagateModelChange = /**
  11823. * @private
  11824. * @param {?=} touched
  11825. * @return {?}
  11826. */
  11827. function (touched) {
  11828. if (touched === void 0) { touched = true; }
  11829. if (touched) {
  11830. this.onTouched();
  11831. }
  11832. if (this.model.isValid(this.seconds)) {
  11833. this.onChange(this._ngbTimeAdapter.toModel({ hour: this.model.hour, minute: this.model.minute, second: this.model.second }));
  11834. }
  11835. else {
  11836. this.onChange(this._ngbTimeAdapter.toModel(null));
  11837. }
  11838. };
  11839. NgbTimepicker.decorators = [
  11840. { type: core.Component, args: [{
  11841. selector: 'ngb-timepicker',
  11842. encapsulation: core.ViewEncapsulation.None,
  11843. template: "\n <fieldset [disabled]=\"disabled\" [class.disabled]=\"disabled\">\n <div class=\"ngb-tp\">\n <div class=\"ngb-tp-input-container ngb-tp-hour\">\n <button *ngIf=\"spinners\" tabindex=\"-1\" type=\"button\" (click)=\"changeHour(hourStep)\"\n class=\"btn btn-link\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\" [class.disabled]=\"disabled\"\n [disabled]=\"disabled\">\n <span class=\"chevron ngb-tp-chevron\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.timepicker.increment-hours\">Increment hours</span>\n </button>\n <input type=\"text\" class=\"ngb-tp-input form-control\" [class.form-control-sm]=\"isSmallSize\"\n [class.form-control-lg]=\"isLargeSize\"\n maxlength=\"2\" inputmode=\"numeric\" placeholder=\"HH\" i18n-placeholder=\"@@ngb.timepicker.HH\"\n [value]=\"formatHour(model?.hour)\" (change)=\"updateHour($event.target.value)\"\n [readOnly]=\"readonlyInputs\" [disabled]=\"disabled\" aria-label=\"Hours\" i18n-aria-label=\"@@ngb.timepicker.hours\"\n (input)=\"formatInput($event.target)\"\n (keydown.ArrowUp)=\"changeHour(hourStep); $event.preventDefault()\"\n (keydown.ArrowDown)=\"changeHour(-hourStep); $event.preventDefault()\">\n <button *ngIf=\"spinners\" tabindex=\"-1\" type=\"button\" (click)=\"changeHour(-hourStep)\"\n class=\"btn btn-link\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\" [class.disabled]=\"disabled\"\n [disabled]=\"disabled\">\n <span class=\"chevron ngb-tp-chevron bottom\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.timepicker.decrement-hours\">Decrement hours</span>\n </button>\n </div>\n <div class=\"ngb-tp-spacer\">:</div>\n <div class=\"ngb-tp-input-container ngb-tp-minute\">\n <button *ngIf=\"spinners\" tabindex=\"-1\" type=\"button\" (click)=\"changeMinute(minuteStep)\"\n class=\"btn btn-link\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\" [class.disabled]=\"disabled\"\n [disabled]=\"disabled\">\n <span class=\"chevron ngb-tp-chevron\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.timepicker.increment-minutes\">Increment minutes</span>\n </button>\n <input type=\"text\" class=\"ngb-tp-input form-control\" [class.form-control-sm]=\"isSmallSize\" [class.form-control-lg]=\"isLargeSize\"\n maxlength=\"2\" inputmode=\"numeric\" placeholder=\"MM\" i18n-placeholder=\"@@ngb.timepicker.MM\"\n [value]=\"formatMinSec(model?.minute)\" (change)=\"updateMinute($event.target.value)\"\n [readOnly]=\"readonlyInputs\" [disabled]=\"disabled\" aria-label=\"Minutes\" i18n-aria-label=\"@@ngb.timepicker.minutes\"\n (input)=\"formatInput($event.target)\"\n (keydown.ArrowUp)=\"changeMinute(minuteStep); $event.preventDefault()\"\n (keydown.ArrowDown)=\"changeMinute(-minuteStep); $event.preventDefault()\">\n <button *ngIf=\"spinners\" tabindex=\"-1\" type=\"button\" (click)=\"changeMinute(-minuteStep)\"\n class=\"btn btn-link\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\" [class.disabled]=\"disabled\"\n [disabled]=\"disabled\">\n <span class=\"chevron ngb-tp-chevron bottom\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.timepicker.decrement-minutes\">Decrement minutes</span>\n </button>\n </div>\n <div *ngIf=\"seconds\" class=\"ngb-tp-spacer\">:</div>\n <div *ngIf=\"seconds\" class=\"ngb-tp-input-container ngb-tp-second\">\n <button *ngIf=\"spinners\" tabindex=\"-1\" type=\"button\" (click)=\"changeSecond(secondStep)\"\n class=\"btn btn-link\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\" [class.disabled]=\"disabled\"\n [disabled]=\"disabled\">\n <span class=\"chevron ngb-tp-chevron\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.timepicker.increment-seconds\">Increment seconds</span>\n </button>\n <input type=\"text\" class=\"ngb-tp-input form-control\" [class.form-control-sm]=\"isSmallSize\" [class.form-control-lg]=\"isLargeSize\"\n maxlength=\"2\" inputmode=\"numeric\" placeholder=\"SS\" i18n-placeholder=\"@@ngb.timepicker.SS\"\n [value]=\"formatMinSec(model?.second)\" (change)=\"updateSecond($event.target.value)\"\n [readOnly]=\"readonlyInputs\" [disabled]=\"disabled\" aria-label=\"Seconds\" i18n-aria-label=\"@@ngb.timepicker.seconds\"\n (input)=\"formatInput($event.target)\"\n (keydown.ArrowUp)=\"changeSecond(secondStep); $event.preventDefault()\"\n (keydown.ArrowDown)=\"changeSecond(-secondStep); $event.preventDefault()\">\n <button *ngIf=\"spinners\" tabindex=\"-1\" type=\"button\" (click)=\"changeSecond(-secondStep)\"\n class=\"btn btn-link\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\" [class.disabled]=\"disabled\"\n [disabled]=\"disabled\">\n <span class=\"chevron ngb-tp-chevron bottom\"></span>\n <span class=\"sr-only\" i18n=\"@@ngb.timepicker.decrement-seconds\">Decrement seconds</span>\n </button>\n </div>\n <div *ngIf=\"meridian\" class=\"ngb-tp-spacer\"></div>\n <div *ngIf=\"meridian\" class=\"ngb-tp-meridian\">\n <button type=\"button\" class=\"btn btn-outline-primary\" [class.btn-sm]=\"isSmallSize\" [class.btn-lg]=\"isLargeSize\"\n [disabled]=\"disabled\" [class.disabled]=\"disabled\"\n (click)=\"toggleMeridian()\">\n <ng-container *ngIf=\"model?.hour >= 12; else am\" i18n=\"@@ngb.timepicker.PM\">{{ i18n.getAfternoonPeriod() }}</ng-container>\n <ng-template #am i18n=\"@@ngb.timepicker.AM\">{{ i18n.getMorningPeriod() }}</ng-template>\n </button>\n </div>\n </div>\n </fieldset>\n ",
  11844. providers: [NGB_TIMEPICKER_VALUE_ACCESSOR],
  11845. styles: ["ngb-timepicker{font-size:1rem}.ngb-tp{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.ngb-tp-input-container{width:4em}.ngb-tp-chevron::before{border-style:solid;border-width:.29em .29em 0 0;content:\"\";display:inline-block;height:.69em;left:.05em;position:relative;top:.15em;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);vertical-align:middle;width:.69em}.ngb-tp-chevron.bottom:before{top:-.3em;-webkit-transform:rotate(135deg);transform:rotate(135deg)}.ngb-tp-input{text-align:center}.ngb-tp-hour,.ngb-tp-meridian,.ngb-tp-minute,.ngb-tp-second{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-ms-flex-align:center;align-items:center;-ms-flex-pack:distribute;justify-content:space-around}.ngb-tp-spacer{width:1em;text-align:center}"]
  11846. }] }
  11847. ];
  11848. /** @nocollapse */
  11849. NgbTimepicker.ctorParameters = function () { return [
  11850. { type: NgbTimepickerConfig },
  11851. { type: NgbTimeAdapter },
  11852. { type: core.ChangeDetectorRef },
  11853. { type: NgbTimepickerI18n }
  11854. ]; };
  11855. NgbTimepicker.propDecorators = {
  11856. meridian: [{ type: core.Input }],
  11857. spinners: [{ type: core.Input }],
  11858. seconds: [{ type: core.Input }],
  11859. hourStep: [{ type: core.Input }],
  11860. minuteStep: [{ type: core.Input }],
  11861. secondStep: [{ type: core.Input }],
  11862. readonlyInputs: [{ type: core.Input }],
  11863. size: [{ type: core.Input }]
  11864. };
  11865. return NgbTimepicker;
  11866. }());
  11867. /**
  11868. * @fileoverview added by tsickle
  11869. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11870. */
  11871. var NgbTimepickerModule = /** @class */ (function () {
  11872. function NgbTimepickerModule() {
  11873. }
  11874. NgbTimepickerModule.decorators = [
  11875. { type: core.NgModule, args: [{ declarations: [NgbTimepicker], exports: [NgbTimepicker], imports: [common.CommonModule] },] }
  11876. ];
  11877. return NgbTimepickerModule;
  11878. }());
  11879. /**
  11880. * @fileoverview added by tsickle
  11881. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11882. */
  11883. /**
  11884. * Configuration service for the NgbToast component. You can inject this service, typically in your root component,
  11885. * and customize the values of its properties in order to provide default values for all the toasts used in the
  11886. * application.
  11887. *
  11888. * \@since 5.0.0
  11889. */
  11890. var NgbToastConfig = /** @class */ (function () {
  11891. function NgbToastConfig() {
  11892. this.autohide = true;
  11893. this.delay = 500;
  11894. this.ariaLive = 'polite';
  11895. }
  11896. NgbToastConfig.decorators = [
  11897. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  11898. ];
  11899. /** @nocollapse */ NgbToastConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbToastConfig_Factory() { return new NgbToastConfig(); }, token: NgbToastConfig, providedIn: "root" });
  11900. return NgbToastConfig;
  11901. }());
  11902. /**
  11903. * @fileoverview added by tsickle
  11904. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  11905. */
  11906. /**
  11907. * This directive allows the usage of HTML markup or other directives
  11908. * inside of the toast's header.
  11909. *
  11910. * \@since 5.0.0
  11911. */
  11912. var NgbToastHeader = /** @class */ (function () {
  11913. function NgbToastHeader() {
  11914. }
  11915. NgbToastHeader.decorators = [
  11916. { type: core.Directive, args: [{ selector: '[ngbToastHeader]' },] }
  11917. ];
  11918. return NgbToastHeader;
  11919. }());
  11920. /**
  11921. * Toasts provide feedback messages as notifications to the user.
  11922. * Goal is to mimic the push notifications available both on mobile and desktop operating systems.
  11923. *
  11924. * \@since 5.0.0
  11925. */
  11926. var NgbToast = /** @class */ (function () {
  11927. function NgbToast(ariaLive, config) {
  11928. this.ariaLive = ariaLive;
  11929. /**
  11930. * A template like `<ng-template ngbToastHeader></ng-template>` can be
  11931. * used in the projected content to allow markup usage.
  11932. */
  11933. this.contentHeaderTpl = null;
  11934. /**
  11935. * An event fired immediately when toast's `hide()` method has been called.
  11936. * It can only occur in 2 different scenarios:
  11937. * - `autohide` timeout fires
  11938. * - user clicks on a closing cross (&times)
  11939. *
  11940. * Additionally this output is purely informative. The toast won't disappear. It's up to the user to take care of
  11941. * that.
  11942. */
  11943. this.hideOutput = new core.EventEmitter();
  11944. if (this.ariaLive == null) {
  11945. this.ariaLive = config.ariaLive;
  11946. }
  11947. this.delay = config.delay;
  11948. this.autohide = config.autohide;
  11949. }
  11950. /**
  11951. * @return {?}
  11952. */
  11953. NgbToast.prototype.ngAfterContentInit = /**
  11954. * @return {?}
  11955. */
  11956. function () { this._init(); };
  11957. /**
  11958. * @param {?} changes
  11959. * @return {?}
  11960. */
  11961. NgbToast.prototype.ngOnChanges = /**
  11962. * @param {?} changes
  11963. * @return {?}
  11964. */
  11965. function (changes) {
  11966. if ('autohide' in changes) {
  11967. this._clearTimeout();
  11968. this._init();
  11969. }
  11970. };
  11971. /**
  11972. * @return {?}
  11973. */
  11974. NgbToast.prototype.hide = /**
  11975. * @return {?}
  11976. */
  11977. function () {
  11978. this._clearTimeout();
  11979. this.hideOutput.emit();
  11980. };
  11981. /**
  11982. * @private
  11983. * @return {?}
  11984. */
  11985. NgbToast.prototype._init = /**
  11986. * @private
  11987. * @return {?}
  11988. */
  11989. function () {
  11990. var _this = this;
  11991. if (this.autohide && !this._timeoutID) {
  11992. this._timeoutID = setTimeout((/**
  11993. * @return {?}
  11994. */
  11995. function () { return _this.hide(); }), this.delay);
  11996. }
  11997. };
  11998. /**
  11999. * @private
  12000. * @return {?}
  12001. */
  12002. NgbToast.prototype._clearTimeout = /**
  12003. * @private
  12004. * @return {?}
  12005. */
  12006. function () {
  12007. if (this._timeoutID) {
  12008. clearTimeout(this._timeoutID);
  12009. this._timeoutID = null;
  12010. }
  12011. };
  12012. NgbToast.decorators = [
  12013. { type: core.Component, args: [{
  12014. selector: 'ngb-toast',
  12015. exportAs: 'ngbToast',
  12016. encapsulation: core.ViewEncapsulation.None,
  12017. host: {
  12018. 'role': 'alert',
  12019. '[attr.aria-live]': 'ariaLive',
  12020. 'aria-atomic': 'true',
  12021. '[class.toast]': 'true',
  12022. '[class.show]': 'true',
  12023. },
  12024. template: "\n <ng-template #headerTpl>\n <strong class=\"mr-auto\">{{header}}</strong>\n </ng-template>\n <ng-template [ngIf]=\"contentHeaderTpl || header\">\n <div class=\"toast-header\">\n <ng-template [ngTemplateOutlet]=\"contentHeaderTpl || headerTpl\"></ng-template>\n <button type=\"button\" class=\"close\" aria-label=\"Close\" i18n-aria-label=\"@@ngb.toast.close-aria\" (click)=\"hide()\">\n <span aria-hidden=\"true\">&times;</span>\n </button>\n </div>\n </ng-template>\n <div class=\"toast-body\">\n <ng-content></ng-content>\n </div>\n ",
  12025. styles: [".ngb-toasts{position:fixed;top:0;right:0;margin:.5em;z-index:1200}ngb-toast .toast-header .close{margin-left:auto;margin-bottom:.25rem}"]
  12026. }] }
  12027. ];
  12028. /** @nocollapse */
  12029. NgbToast.ctorParameters = function () { return [
  12030. { type: String, decorators: [{ type: core.Attribute, args: ['aria-live',] }] },
  12031. { type: NgbToastConfig }
  12032. ]; };
  12033. NgbToast.propDecorators = {
  12034. delay: [{ type: core.Input }],
  12035. autohide: [{ type: core.Input }],
  12036. header: [{ type: core.Input }],
  12037. contentHeaderTpl: [{ type: core.ContentChild, args: [NgbToastHeader, { read: core.TemplateRef, static: true },] }],
  12038. hideOutput: [{ type: core.Output, args: ['hide',] }]
  12039. };
  12040. return NgbToast;
  12041. }());
  12042. /**
  12043. * @fileoverview added by tsickle
  12044. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12045. */
  12046. var NgbToastModule = /** @class */ (function () {
  12047. function NgbToastModule() {
  12048. }
  12049. NgbToastModule.decorators = [
  12050. { type: core.NgModule, args: [{ declarations: [NgbToast, NgbToastHeader], imports: [common.CommonModule], exports: [NgbToast, NgbToastHeader] },] }
  12051. ];
  12052. return NgbToastModule;
  12053. }());
  12054. /**
  12055. * @fileoverview added by tsickle
  12056. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12057. */
  12058. /**
  12059. * A configuration service for the [`NgbTooltip`](#/components/tooltip/api#NgbTooltip) component.
  12060. *
  12061. * You can inject this service, typically in your root component, and customize the values of its properties in
  12062. * order to provide default values for all the tooltips used in the application.
  12063. */
  12064. var NgbTooltipConfig = /** @class */ (function () {
  12065. function NgbTooltipConfig() {
  12066. this.autoClose = true;
  12067. this.placement = 'auto';
  12068. this.triggers = 'hover focus';
  12069. this.disableTooltip = false;
  12070. this.openDelay = 0;
  12071. this.closeDelay = 0;
  12072. }
  12073. NgbTooltipConfig.decorators = [
  12074. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  12075. ];
  12076. /** @nocollapse */ NgbTooltipConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbTooltipConfig_Factory() { return new NgbTooltipConfig(); }, token: NgbTooltipConfig, providedIn: "root" });
  12077. return NgbTooltipConfig;
  12078. }());
  12079. /**
  12080. * @fileoverview added by tsickle
  12081. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12082. */
  12083. /** @type {?} */
  12084. var nextId$5 = 0;
  12085. var NgbTooltipWindow = /** @class */ (function () {
  12086. function NgbTooltipWindow() {
  12087. }
  12088. NgbTooltipWindow.decorators = [
  12089. { type: core.Component, args: [{
  12090. selector: 'ngb-tooltip-window',
  12091. changeDetection: core.ChangeDetectionStrategy.OnPush,
  12092. encapsulation: core.ViewEncapsulation.None,
  12093. host: { '[class]': '"tooltip show" + (tooltipClass ? " " + tooltipClass : "")', 'role': 'tooltip', '[id]': 'id' },
  12094. template: "<div class=\"arrow\"></div><div class=\"tooltip-inner\"><ng-content></ng-content></div>",
  12095. styles: ["ngb-tooltip-window.bs-tooltip-bottom .arrow,ngb-tooltip-window.bs-tooltip-top .arrow{left:calc(50% - .4rem)}ngb-tooltip-window.bs-tooltip-bottom-left .arrow,ngb-tooltip-window.bs-tooltip-top-left .arrow{left:1em}ngb-tooltip-window.bs-tooltip-bottom-right .arrow,ngb-tooltip-window.bs-tooltip-top-right .arrow{left:auto;right:.8rem}ngb-tooltip-window.bs-tooltip-left .arrow,ngb-tooltip-window.bs-tooltip-right .arrow{top:calc(50% - .4rem)}ngb-tooltip-window.bs-tooltip-left-top .arrow,ngb-tooltip-window.bs-tooltip-right-top .arrow{top:.4rem}ngb-tooltip-window.bs-tooltip-left-bottom .arrow,ngb-tooltip-window.bs-tooltip-right-bottom .arrow{top:auto;bottom:.4rem}"]
  12096. }] }
  12097. ];
  12098. NgbTooltipWindow.propDecorators = {
  12099. id: [{ type: core.Input }],
  12100. tooltipClass: [{ type: core.Input }]
  12101. };
  12102. return NgbTooltipWindow;
  12103. }());
  12104. /**
  12105. * A lightweight and extensible directive for fancy tooltip creation.
  12106. */
  12107. var NgbTooltip = /** @class */ (function () {
  12108. function NgbTooltip(_elementRef, _renderer, injector, componentFactoryResolver, viewContainerRef, config, _ngZone, _document, _changeDetector, applicationRef) {
  12109. var _this = this;
  12110. this._elementRef = _elementRef;
  12111. this._renderer = _renderer;
  12112. this._ngZone = _ngZone;
  12113. this._document = _document;
  12114. this._changeDetector = _changeDetector;
  12115. /**
  12116. * An event emitted when the tooltip is shown. Contains no payload.
  12117. */
  12118. this.shown = new core.EventEmitter();
  12119. /**
  12120. * An event emitted when the popover is hidden. Contains no payload.
  12121. */
  12122. this.hidden = new core.EventEmitter();
  12123. this._ngbTooltipWindowId = "ngb-tooltip-" + nextId$5++;
  12124. this.autoClose = config.autoClose;
  12125. this.placement = config.placement;
  12126. this.triggers = config.triggers;
  12127. this.container = config.container;
  12128. this.disableTooltip = config.disableTooltip;
  12129. this.tooltipClass = config.tooltipClass;
  12130. this.openDelay = config.openDelay;
  12131. this.closeDelay = config.closeDelay;
  12132. this._popupService = new PopupService(NgbTooltipWindow, injector, viewContainerRef, _renderer, componentFactoryResolver, applicationRef);
  12133. this._zoneSubscription = _ngZone.onStable.subscribe((/**
  12134. * @return {?}
  12135. */
  12136. function () {
  12137. if (_this._windowRef) {
  12138. positionElements(_this._elementRef.nativeElement, _this._windowRef.location.nativeElement, _this.placement, _this.container === 'body', 'bs-tooltip');
  12139. }
  12140. }));
  12141. }
  12142. Object.defineProperty(NgbTooltip.prototype, "ngbTooltip", {
  12143. get: /**
  12144. * @return {?}
  12145. */
  12146. function () { return this._ngbTooltip; },
  12147. /**
  12148. * The string content or a `TemplateRef` for the content to be displayed in the tooltip.
  12149. *
  12150. * If the content if falsy, the tooltip won't open.
  12151. */
  12152. set: /**
  12153. * The string content or a `TemplateRef` for the content to be displayed in the tooltip.
  12154. *
  12155. * If the content if falsy, the tooltip won't open.
  12156. * @param {?} value
  12157. * @return {?}
  12158. */
  12159. function (value) {
  12160. this._ngbTooltip = value;
  12161. if (!value && this._windowRef) {
  12162. this.close();
  12163. }
  12164. },
  12165. enumerable: true,
  12166. configurable: true
  12167. });
  12168. /**
  12169. * Opens the tooltip.
  12170. *
  12171. * This is considered to be a "manual" triggering.
  12172. * The `context` is an optional value to be injected into the tooltip template when it is created.
  12173. */
  12174. /**
  12175. * Opens the tooltip.
  12176. *
  12177. * This is considered to be a "manual" triggering.
  12178. * The `context` is an optional value to be injected into the tooltip template when it is created.
  12179. * @param {?=} context
  12180. * @return {?}
  12181. */
  12182. NgbTooltip.prototype.open = /**
  12183. * Opens the tooltip.
  12184. *
  12185. * This is considered to be a "manual" triggering.
  12186. * The `context` is an optional value to be injected into the tooltip template when it is created.
  12187. * @param {?=} context
  12188. * @return {?}
  12189. */
  12190. function (context) {
  12191. var _this = this;
  12192. if (!this._windowRef && this._ngbTooltip && !this.disableTooltip) {
  12193. this._windowRef = this._popupService.open(this._ngbTooltip, context);
  12194. this._windowRef.instance.tooltipClass = this.tooltipClass;
  12195. this._windowRef.instance.id = this._ngbTooltipWindowId;
  12196. this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', this._ngbTooltipWindowId);
  12197. if (this.container === 'body') {
  12198. this._document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement);
  12199. }
  12200. // We need to detect changes, because we don't know where .open() might be called from.
  12201. // Ex. opening tooltip from one of lifecycle hooks that run after the CD
  12202. // (say from ngAfterViewInit) will result in 'ExpressionHasChanged' exception
  12203. this._windowRef.changeDetectorRef.detectChanges();
  12204. // We need to mark for check, because tooltip won't work inside the OnPush component.
  12205. // Ex. when we use expression like `{{ tooltip.isOpen() : 'opened' : 'closed' }}`
  12206. // inside the template of an OnPush component and we change the tooltip from
  12207. // open -> closed, the expression in question won't be updated unless we explicitly
  12208. // mark the parent component to be checked.
  12209. this._windowRef.changeDetectorRef.markForCheck();
  12210. ngbAutoClose(this._ngZone, this._document, this.autoClose, (/**
  12211. * @return {?}
  12212. */
  12213. function () { return _this.close(); }), this.hidden, [this._windowRef.location.nativeElement]);
  12214. this.shown.emit();
  12215. }
  12216. };
  12217. /**
  12218. * Closes the tooltip.
  12219. *
  12220. * This is considered to be a "manual" triggering of the tooltip.
  12221. */
  12222. /**
  12223. * Closes the tooltip.
  12224. *
  12225. * This is considered to be a "manual" triggering of the tooltip.
  12226. * @return {?}
  12227. */
  12228. NgbTooltip.prototype.close = /**
  12229. * Closes the tooltip.
  12230. *
  12231. * This is considered to be a "manual" triggering of the tooltip.
  12232. * @return {?}
  12233. */
  12234. function () {
  12235. if (this._windowRef != null) {
  12236. this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
  12237. this._popupService.close();
  12238. this._windowRef = null;
  12239. this.hidden.emit();
  12240. this._changeDetector.markForCheck();
  12241. }
  12242. };
  12243. /**
  12244. * Toggles the tooltip.
  12245. *
  12246. * This is considered to be a "manual" triggering of the tooltip.
  12247. */
  12248. /**
  12249. * Toggles the tooltip.
  12250. *
  12251. * This is considered to be a "manual" triggering of the tooltip.
  12252. * @return {?}
  12253. */
  12254. NgbTooltip.prototype.toggle = /**
  12255. * Toggles the tooltip.
  12256. *
  12257. * This is considered to be a "manual" triggering of the tooltip.
  12258. * @return {?}
  12259. */
  12260. function () {
  12261. if (this._windowRef) {
  12262. this.close();
  12263. }
  12264. else {
  12265. this.open();
  12266. }
  12267. };
  12268. /**
  12269. * Returns `true`, if the popover is currently shown.
  12270. */
  12271. /**
  12272. * Returns `true`, if the popover is currently shown.
  12273. * @return {?}
  12274. */
  12275. NgbTooltip.prototype.isOpen = /**
  12276. * Returns `true`, if the popover is currently shown.
  12277. * @return {?}
  12278. */
  12279. function () { return this._windowRef != null; };
  12280. /**
  12281. * @return {?}
  12282. */
  12283. NgbTooltip.prototype.ngOnInit = /**
  12284. * @return {?}
  12285. */
  12286. function () {
  12287. this._unregisterListenersFn = listenToTriggers(this._renderer, this._elementRef.nativeElement, this.triggers, this.isOpen.bind(this), this.open.bind(this), this.close.bind(this), +this.openDelay, +this.closeDelay);
  12288. };
  12289. /**
  12290. * @param {?} __0
  12291. * @return {?}
  12292. */
  12293. NgbTooltip.prototype.ngOnChanges = /**
  12294. * @param {?} __0
  12295. * @return {?}
  12296. */
  12297. function (_a) {
  12298. var tooltipClass = _a.tooltipClass;
  12299. if (tooltipClass && this.isOpen()) {
  12300. this._windowRef.instance.tooltipClass = tooltipClass.currentValue;
  12301. }
  12302. };
  12303. /**
  12304. * @return {?}
  12305. */
  12306. NgbTooltip.prototype.ngOnDestroy = /**
  12307. * @return {?}
  12308. */
  12309. function () {
  12310. this.close();
  12311. // This check is needed as it might happen that ngOnDestroy is called before ngOnInit
  12312. // under certain conditions, see: https://github.com/ng-bootstrap/ng-bootstrap/issues/2199
  12313. if (this._unregisterListenersFn) {
  12314. this._unregisterListenersFn();
  12315. }
  12316. this._zoneSubscription.unsubscribe();
  12317. };
  12318. NgbTooltip.decorators = [
  12319. { type: core.Directive, args: [{ selector: '[ngbTooltip]', exportAs: 'ngbTooltip' },] }
  12320. ];
  12321. /** @nocollapse */
  12322. NgbTooltip.ctorParameters = function () { return [
  12323. { type: core.ElementRef },
  12324. { type: core.Renderer2 },
  12325. { type: core.Injector },
  12326. { type: core.ComponentFactoryResolver },
  12327. { type: core.ViewContainerRef },
  12328. { type: NgbTooltipConfig },
  12329. { type: core.NgZone },
  12330. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  12331. { type: core.ChangeDetectorRef },
  12332. { type: core.ApplicationRef }
  12333. ]; };
  12334. NgbTooltip.propDecorators = {
  12335. autoClose: [{ type: core.Input }],
  12336. placement: [{ type: core.Input }],
  12337. triggers: [{ type: core.Input }],
  12338. container: [{ type: core.Input }],
  12339. disableTooltip: [{ type: core.Input }],
  12340. tooltipClass: [{ type: core.Input }],
  12341. openDelay: [{ type: core.Input }],
  12342. closeDelay: [{ type: core.Input }],
  12343. shown: [{ type: core.Output }],
  12344. hidden: [{ type: core.Output }],
  12345. ngbTooltip: [{ type: core.Input }]
  12346. };
  12347. return NgbTooltip;
  12348. }());
  12349. /**
  12350. * @fileoverview added by tsickle
  12351. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12352. */
  12353. var NgbTooltipModule = /** @class */ (function () {
  12354. function NgbTooltipModule() {
  12355. }
  12356. NgbTooltipModule.decorators = [
  12357. { type: core.NgModule, args: [{ declarations: [NgbTooltip, NgbTooltipWindow], exports: [NgbTooltip], entryComponents: [NgbTooltipWindow] },] }
  12358. ];
  12359. return NgbTooltipModule;
  12360. }());
  12361. /**
  12362. * @fileoverview added by tsickle
  12363. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12364. */
  12365. /**
  12366. * A component that helps with text highlighting.
  12367. *
  12368. * If splits the `result` text into parts that contain the searched `term` and generates the HTML markup to simplify
  12369. * highlighting:
  12370. *
  12371. * Ex. `result="Alaska"` and `term="as"` will produce `Al<span class="ngb-highlight">as</span>ka`.
  12372. */
  12373. var NgbHighlight = /** @class */ (function () {
  12374. function NgbHighlight() {
  12375. /**
  12376. * The CSS class for `<span>` elements wrapping the `term` inside the `result`.
  12377. */
  12378. this.highlightClass = 'ngb-highlight';
  12379. }
  12380. /**
  12381. * @param {?} changes
  12382. * @return {?}
  12383. */
  12384. NgbHighlight.prototype.ngOnChanges = /**
  12385. * @param {?} changes
  12386. * @return {?}
  12387. */
  12388. function (changes) {
  12389. /** @type {?} */
  12390. var result = toString(this.result);
  12391. /** @type {?} */
  12392. var terms = Array.isArray(this.term) ? this.term : [this.term];
  12393. /** @type {?} */
  12394. var escapedTerms = terms.map((/**
  12395. * @param {?} term
  12396. * @return {?}
  12397. */
  12398. function (term) { return regExpEscape(toString(term)); })).filter((/**
  12399. * @param {?} term
  12400. * @return {?}
  12401. */
  12402. function (term) { return term; }));
  12403. this.parts = escapedTerms.length ? result.split(new RegExp("(" + escapedTerms.join('|') + ")", 'gmi')) : [result];
  12404. };
  12405. NgbHighlight.decorators = [
  12406. { type: core.Component, args: [{
  12407. selector: 'ngb-highlight',
  12408. changeDetection: core.ChangeDetectionStrategy.OnPush,
  12409. encapsulation: core.ViewEncapsulation.None,
  12410. template: "<ng-template ngFor [ngForOf]=\"parts\" let-part let-isOdd=\"odd\">" +
  12411. "<span *ngIf=\"isOdd; else even\" [class]=\"highlightClass\">{{part}}</span><ng-template #even>{{part}}</ng-template>" +
  12412. "</ng-template>",
  12413. styles: [".ngb-highlight{font-weight:700}"]
  12414. }] }
  12415. ];
  12416. NgbHighlight.propDecorators = {
  12417. highlightClass: [{ type: core.Input }],
  12418. result: [{ type: core.Input }],
  12419. term: [{ type: core.Input }]
  12420. };
  12421. return NgbHighlight;
  12422. }());
  12423. /**
  12424. * @fileoverview added by tsickle
  12425. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12426. */
  12427. var NgbTypeaheadWindow = /** @class */ (function () {
  12428. function NgbTypeaheadWindow() {
  12429. this.activeIdx = 0;
  12430. /**
  12431. * Flag indicating if the first row should be active initially
  12432. */
  12433. this.focusFirst = true;
  12434. /**
  12435. * A function used to format a given result before display. This function should return a formatted string without any
  12436. * HTML markup
  12437. */
  12438. this.formatter = toString;
  12439. /**
  12440. * Event raised when user selects a particular result row
  12441. */
  12442. this.selectEvent = new core.EventEmitter();
  12443. this.activeChangeEvent = new core.EventEmitter();
  12444. }
  12445. /**
  12446. * @return {?}
  12447. */
  12448. NgbTypeaheadWindow.prototype.hasActive = /**
  12449. * @return {?}
  12450. */
  12451. function () { return this.activeIdx > -1 && this.activeIdx < this.results.length; };
  12452. /**
  12453. * @return {?}
  12454. */
  12455. NgbTypeaheadWindow.prototype.getActive = /**
  12456. * @return {?}
  12457. */
  12458. function () { return this.results[this.activeIdx]; };
  12459. /**
  12460. * @param {?} activeIdx
  12461. * @return {?}
  12462. */
  12463. NgbTypeaheadWindow.prototype.markActive = /**
  12464. * @param {?} activeIdx
  12465. * @return {?}
  12466. */
  12467. function (activeIdx) {
  12468. this.activeIdx = activeIdx;
  12469. this._activeChanged();
  12470. };
  12471. /**
  12472. * @return {?}
  12473. */
  12474. NgbTypeaheadWindow.prototype.next = /**
  12475. * @return {?}
  12476. */
  12477. function () {
  12478. if (this.activeIdx === this.results.length - 1) {
  12479. this.activeIdx = this.focusFirst ? (this.activeIdx + 1) % this.results.length : -1;
  12480. }
  12481. else {
  12482. this.activeIdx++;
  12483. }
  12484. this._activeChanged();
  12485. };
  12486. /**
  12487. * @return {?}
  12488. */
  12489. NgbTypeaheadWindow.prototype.prev = /**
  12490. * @return {?}
  12491. */
  12492. function () {
  12493. if (this.activeIdx < 0) {
  12494. this.activeIdx = this.results.length - 1;
  12495. }
  12496. else if (this.activeIdx === 0) {
  12497. this.activeIdx = this.focusFirst ? this.results.length - 1 : -1;
  12498. }
  12499. else {
  12500. this.activeIdx--;
  12501. }
  12502. this._activeChanged();
  12503. };
  12504. /**
  12505. * @return {?}
  12506. */
  12507. NgbTypeaheadWindow.prototype.resetActive = /**
  12508. * @return {?}
  12509. */
  12510. function () {
  12511. this.activeIdx = this.focusFirst ? 0 : -1;
  12512. this._activeChanged();
  12513. };
  12514. /**
  12515. * @param {?} item
  12516. * @return {?}
  12517. */
  12518. NgbTypeaheadWindow.prototype.select = /**
  12519. * @param {?} item
  12520. * @return {?}
  12521. */
  12522. function (item) { this.selectEvent.emit(item); };
  12523. /**
  12524. * @return {?}
  12525. */
  12526. NgbTypeaheadWindow.prototype.ngOnInit = /**
  12527. * @return {?}
  12528. */
  12529. function () { this.resetActive(); };
  12530. /**
  12531. * @private
  12532. * @return {?}
  12533. */
  12534. NgbTypeaheadWindow.prototype._activeChanged = /**
  12535. * @private
  12536. * @return {?}
  12537. */
  12538. function () {
  12539. this.activeChangeEvent.emit(this.activeIdx >= 0 ? this.id + '-' + this.activeIdx : undefined);
  12540. };
  12541. NgbTypeaheadWindow.decorators = [
  12542. { type: core.Component, args: [{
  12543. selector: 'ngb-typeahead-window',
  12544. exportAs: 'ngbTypeaheadWindow',
  12545. encapsulation: core.ViewEncapsulation.None,
  12546. host: { '(mousedown)': '$event.preventDefault()', 'class': 'dropdown-menu show', 'role': 'listbox', '[id]': 'id' },
  12547. template: "\n <ng-template #rt let-result=\"result\" let-term=\"term\" let-formatter=\"formatter\">\n <ngb-highlight [result]=\"formatter(result)\" [term]=\"term\"></ngb-highlight>\n </ng-template>\n <ng-template ngFor [ngForOf]=\"results\" let-result let-idx=\"index\">\n <button type=\"button\" class=\"dropdown-item\" role=\"option\"\n [id]=\"id + '-' + idx\"\n [class.active]=\"idx === activeIdx\"\n (mouseenter)=\"markActive(idx)\"\n (click)=\"select(result)\">\n <ng-template [ngTemplateOutlet]=\"resultTemplate || rt\"\n [ngTemplateOutletContext]=\"{result: result, term: term, formatter: formatter}\"></ng-template>\n </button>\n </ng-template>\n "
  12548. }] }
  12549. ];
  12550. NgbTypeaheadWindow.propDecorators = {
  12551. id: [{ type: core.Input }],
  12552. focusFirst: [{ type: core.Input }],
  12553. results: [{ type: core.Input }],
  12554. term: [{ type: core.Input }],
  12555. formatter: [{ type: core.Input }],
  12556. resultTemplate: [{ type: core.Input }],
  12557. selectEvent: [{ type: core.Output, args: ['select',] }],
  12558. activeChangeEvent: [{ type: core.Output, args: ['activeChange',] }]
  12559. };
  12560. return NgbTypeaheadWindow;
  12561. }());
  12562. /**
  12563. * @fileoverview added by tsickle
  12564. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12565. */
  12566. /** @type {?} */
  12567. var ARIA_LIVE_DELAY = new core.InjectionToken('live announcer delay', { providedIn: 'root', factory: ARIA_LIVE_DELAY_FACTORY });
  12568. /**
  12569. * @return {?}
  12570. */
  12571. function ARIA_LIVE_DELAY_FACTORY() {
  12572. return 100;
  12573. }
  12574. /**
  12575. * @param {?} document
  12576. * @param {?=} lazyCreate
  12577. * @return {?}
  12578. */
  12579. function getLiveElement(document, lazyCreate) {
  12580. if (lazyCreate === void 0) { lazyCreate = false; }
  12581. /** @type {?} */
  12582. var element = (/** @type {?} */ (document.body.querySelector('#ngb-live')));
  12583. if (element == null && lazyCreate) {
  12584. element = document.createElement('div');
  12585. element.setAttribute('id', 'ngb-live');
  12586. element.setAttribute('aria-live', 'polite');
  12587. element.setAttribute('aria-atomic', 'true');
  12588. element.classList.add('sr-only');
  12589. document.body.appendChild(element);
  12590. }
  12591. return element;
  12592. }
  12593. var Live = /** @class */ (function () {
  12594. function Live(_document, _delay) {
  12595. this._document = _document;
  12596. this._delay = _delay;
  12597. }
  12598. /**
  12599. * @return {?}
  12600. */
  12601. Live.prototype.ngOnDestroy = /**
  12602. * @return {?}
  12603. */
  12604. function () {
  12605. /** @type {?} */
  12606. var element = getLiveElement(this._document);
  12607. if (element) {
  12608. element.parentElement.removeChild(element);
  12609. }
  12610. };
  12611. /**
  12612. * @param {?} message
  12613. * @return {?}
  12614. */
  12615. Live.prototype.say = /**
  12616. * @param {?} message
  12617. * @return {?}
  12618. */
  12619. function (message) {
  12620. /** @type {?} */
  12621. var element = getLiveElement(this._document, true);
  12622. /** @type {?} */
  12623. var delay = this._delay;
  12624. element.textContent = '';
  12625. /** @type {?} */
  12626. var setText = (/**
  12627. * @return {?}
  12628. */
  12629. function () { return element.textContent = message; });
  12630. if (delay === null) {
  12631. setText();
  12632. }
  12633. else {
  12634. setTimeout(setText, delay);
  12635. }
  12636. };
  12637. Live.decorators = [
  12638. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  12639. ];
  12640. /** @nocollapse */
  12641. Live.ctorParameters = function () { return [
  12642. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  12643. { type: undefined, decorators: [{ type: core.Inject, args: [ARIA_LIVE_DELAY,] }] }
  12644. ]; };
  12645. /** @nocollapse */ Live.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function Live_Factory() { return new Live(core.ɵɵinject(common.DOCUMENT), core.ɵɵinject(ARIA_LIVE_DELAY)); }, token: Live, providedIn: "root" });
  12646. return Live;
  12647. }());
  12648. /**
  12649. * @fileoverview added by tsickle
  12650. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12651. */
  12652. /**
  12653. * A configuration service for the [`NgbTypeahead`](#/components/typeahead/api#NgbTypeahead) component.
  12654. *
  12655. * You can inject this service, typically in your root component, and customize the values of its properties in
  12656. * order to provide default values for all the typeaheads used in the application.
  12657. */
  12658. var NgbTypeaheadConfig = /** @class */ (function () {
  12659. function NgbTypeaheadConfig() {
  12660. this.editable = true;
  12661. this.focusFirst = true;
  12662. this.showHint = false;
  12663. this.placement = ['bottom-left', 'bottom-right', 'top-left', 'top-right'];
  12664. }
  12665. NgbTypeaheadConfig.decorators = [
  12666. { type: core.Injectable, args: [{ providedIn: 'root' },] }
  12667. ];
  12668. /** @nocollapse */ NgbTypeaheadConfig.ngInjectableDef = core.ɵɵdefineInjectable({ factory: function NgbTypeaheadConfig_Factory() { return new NgbTypeaheadConfig(); }, token: NgbTypeaheadConfig, providedIn: "root" });
  12669. return NgbTypeaheadConfig;
  12670. }());
  12671. /**
  12672. * @fileoverview added by tsickle
  12673. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  12674. */
  12675. /** @type {?} */
  12676. var NGB_TYPEAHEAD_VALUE_ACCESSOR = {
  12677. provide: forms.NG_VALUE_ACCESSOR,
  12678. useExisting: core.forwardRef((/**
  12679. * @return {?}
  12680. */
  12681. function () { return NgbTypeahead; })),
  12682. multi: true
  12683. };
  12684. /** @type {?} */
  12685. var nextWindowId = 0;
  12686. /**
  12687. * A directive providing a simple way of creating powerful typeaheads from any text input.
  12688. */
  12689. var NgbTypeahead = /** @class */ (function () {
  12690. function NgbTypeahead(_elementRef, viewContainerRef, _renderer, injector, componentFactoryResolver, config, ngZone, _live, _document, _ngZone, _changeDetector, applicationRef) {
  12691. var _this = this;
  12692. this._elementRef = _elementRef;
  12693. this._renderer = _renderer;
  12694. this._live = _live;
  12695. this._document = _document;
  12696. this._ngZone = _ngZone;
  12697. this._changeDetector = _changeDetector;
  12698. this._closed$ = new rxjs.Subject();
  12699. /**
  12700. * The value for the `autocomplete` attribute for the `<input>` element.
  12701. *
  12702. * Defaults to `"off"` to disable the native browser autocomplete, but you can override it if necessary.
  12703. *
  12704. * \@since 2.1.0
  12705. */
  12706. this.autocomplete = 'off';
  12707. /**
  12708. * The preferred placement of the typeahead.
  12709. *
  12710. * Possible values are `"top"`, `"top-left"`, `"top-right"`, `"bottom"`, `"bottom-left"`,
  12711. * `"bottom-right"`, `"left"`, `"left-top"`, `"left-bottom"`, `"right"`, `"right-top"`,
  12712. * `"right-bottom"`
  12713. *
  12714. * Accepts an array of strings or a string with space separated possible values.
  12715. *
  12716. * The default order of preference is `"bottom-left bottom-right top-left top-right"`
  12717. *
  12718. * Please see the [positioning overview](#/positioning) for more details.
  12719. */
  12720. this.placement = 'bottom-left';
  12721. /**
  12722. * An event emitted right before an item is selected from the result list.
  12723. *
  12724. * Event payload is of type [`NgbTypeaheadSelectItemEvent`](#/components/typeahead/api#NgbTypeaheadSelectItemEvent).
  12725. */
  12726. this.selectItem = new core.EventEmitter();
  12727. this.popupId = "ngb-typeahead-" + nextWindowId++;
  12728. this._onTouched = (/**
  12729. * @return {?}
  12730. */
  12731. function () { });
  12732. this._onChange = (/**
  12733. * @param {?} _
  12734. * @return {?}
  12735. */
  12736. function (_) { });
  12737. this.container = config.container;
  12738. this.editable = config.editable;
  12739. this.focusFirst = config.focusFirst;
  12740. this.showHint = config.showHint;
  12741. this.placement = config.placement;
  12742. this._valueChanges = rxjs.fromEvent(_elementRef.nativeElement, 'input')
  12743. .pipe(operators.map((/**
  12744. * @param {?} $event
  12745. * @return {?}
  12746. */
  12747. function ($event) { return ((/** @type {?} */ ($event.target))).value; })));
  12748. this._resubscribeTypeahead = new rxjs.BehaviorSubject(null);
  12749. this._popupService = new PopupService(NgbTypeaheadWindow, injector, viewContainerRef, _renderer, componentFactoryResolver, applicationRef);
  12750. this._zoneSubscription = ngZone.onStable.subscribe((/**
  12751. * @return {?}
  12752. */
  12753. function () {
  12754. if (_this.isPopupOpen()) {
  12755. positionElements(_this._elementRef.nativeElement, _this._windowRef.location.nativeElement, _this.placement, _this.container === 'body');
  12756. }
  12757. }));
  12758. }
  12759. /**
  12760. * @return {?}
  12761. */
  12762. NgbTypeahead.prototype.ngOnInit = /**
  12763. * @return {?}
  12764. */
  12765. function () {
  12766. var _this = this;
  12767. /** @type {?} */
  12768. var inputValues$ = this._valueChanges.pipe(operators.tap((/**
  12769. * @param {?} value
  12770. * @return {?}
  12771. */
  12772. function (value) {
  12773. _this._inputValueBackup = _this.showHint ? value : null;
  12774. _this._onChange(_this.editable ? value : undefined);
  12775. })));
  12776. /** @type {?} */
  12777. var results$ = inputValues$.pipe(this.ngbTypeahead);
  12778. /** @type {?} */
  12779. var userInput$ = this._resubscribeTypeahead.pipe(operators.switchMap((/**
  12780. * @return {?}
  12781. */
  12782. function () { return results$; })));
  12783. this._subscription = this._subscribeToUserInput(userInput$);
  12784. };
  12785. /**
  12786. * @return {?}
  12787. */
  12788. NgbTypeahead.prototype.ngOnDestroy = /**
  12789. * @return {?}
  12790. */
  12791. function () {
  12792. this._closePopup();
  12793. this._unsubscribeFromUserInput();
  12794. this._zoneSubscription.unsubscribe();
  12795. };
  12796. /**
  12797. * @param {?} fn
  12798. * @return {?}
  12799. */
  12800. NgbTypeahead.prototype.registerOnChange = /**
  12801. * @param {?} fn
  12802. * @return {?}
  12803. */
  12804. function (fn) { this._onChange = fn; };
  12805. /**
  12806. * @param {?} fn
  12807. * @return {?}
  12808. */
  12809. NgbTypeahead.prototype.registerOnTouched = /**
  12810. * @param {?} fn
  12811. * @return {?}
  12812. */
  12813. function (fn) { this._onTouched = fn; };
  12814. /**
  12815. * @param {?} value
  12816. * @return {?}
  12817. */
  12818. NgbTypeahead.prototype.writeValue = /**
  12819. * @param {?} value
  12820. * @return {?}
  12821. */
  12822. function (value) {
  12823. this._writeInputValue(this._formatItemForInput(value));
  12824. if (this.showHint) {
  12825. this._inputValueBackup = value;
  12826. }
  12827. };
  12828. /**
  12829. * @param {?} isDisabled
  12830. * @return {?}
  12831. */
  12832. NgbTypeahead.prototype.setDisabledState = /**
  12833. * @param {?} isDisabled
  12834. * @return {?}
  12835. */
  12836. function (isDisabled) {
  12837. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  12838. };
  12839. /**
  12840. * Dismisses typeahead popup window
  12841. */
  12842. /**
  12843. * Dismisses typeahead popup window
  12844. * @return {?}
  12845. */
  12846. NgbTypeahead.prototype.dismissPopup = /**
  12847. * Dismisses typeahead popup window
  12848. * @return {?}
  12849. */
  12850. function () {
  12851. if (this.isPopupOpen()) {
  12852. this._resubscribeTypeahead.next(null);
  12853. this._closePopup();
  12854. if (this.showHint && this._inputValueBackup !== null) {
  12855. this._writeInputValue(this._inputValueBackup);
  12856. }
  12857. this._changeDetector.markForCheck();
  12858. }
  12859. };
  12860. /**
  12861. * Returns true if the typeahead popup window is displayed
  12862. */
  12863. /**
  12864. * Returns true if the typeahead popup window is displayed
  12865. * @return {?}
  12866. */
  12867. NgbTypeahead.prototype.isPopupOpen = /**
  12868. * Returns true if the typeahead popup window is displayed
  12869. * @return {?}
  12870. */
  12871. function () { return this._windowRef != null; };
  12872. /**
  12873. * @return {?}
  12874. */
  12875. NgbTypeahead.prototype.handleBlur = /**
  12876. * @return {?}
  12877. */
  12878. function () {
  12879. this._resubscribeTypeahead.next(null);
  12880. this._onTouched();
  12881. };
  12882. /**
  12883. * @param {?} event
  12884. * @return {?}
  12885. */
  12886. NgbTypeahead.prototype.handleKeyDown = /**
  12887. * @param {?} event
  12888. * @return {?}
  12889. */
  12890. function (event) {
  12891. if (!this.isPopupOpen()) {
  12892. return;
  12893. }
  12894. // tslint:disable-next-line:deprecation
  12895. switch (event.which) {
  12896. case Key.ArrowDown:
  12897. event.preventDefault();
  12898. this._windowRef.instance.next();
  12899. this._showHint();
  12900. break;
  12901. case Key.ArrowUp:
  12902. event.preventDefault();
  12903. this._windowRef.instance.prev();
  12904. this._showHint();
  12905. break;
  12906. case Key.Enter:
  12907. case Key.Tab:
  12908. /** @type {?} */
  12909. var result = this._windowRef.instance.getActive();
  12910. if (isDefined(result)) {
  12911. event.preventDefault();
  12912. event.stopPropagation();
  12913. this._selectResult(result);
  12914. }
  12915. this._closePopup();
  12916. break;
  12917. }
  12918. };
  12919. /**
  12920. * @private
  12921. * @return {?}
  12922. */
  12923. NgbTypeahead.prototype._openPopup = /**
  12924. * @private
  12925. * @return {?}
  12926. */
  12927. function () {
  12928. var _this = this;
  12929. if (!this.isPopupOpen()) {
  12930. this._inputValueBackup = this._elementRef.nativeElement.value;
  12931. this._windowRef = this._popupService.open();
  12932. this._windowRef.instance.id = this.popupId;
  12933. this._windowRef.instance.selectEvent.subscribe((/**
  12934. * @param {?} result
  12935. * @return {?}
  12936. */
  12937. function (result) { return _this._selectResultClosePopup(result); }));
  12938. this._windowRef.instance.activeChangeEvent.subscribe((/**
  12939. * @param {?} activeId
  12940. * @return {?}
  12941. */
  12942. function (activeId) { return _this.activeDescendant = activeId; }));
  12943. if (this.container === 'body') {
  12944. window.document.querySelector(this.container).appendChild(this._windowRef.location.nativeElement);
  12945. }
  12946. this._changeDetector.markForCheck();
  12947. ngbAutoClose(this._ngZone, this._document, 'outside', (/**
  12948. * @return {?}
  12949. */
  12950. function () { return _this.dismissPopup(); }), this._closed$, [this._elementRef.nativeElement, this._windowRef.location.nativeElement]);
  12951. }
  12952. };
  12953. /**
  12954. * @private
  12955. * @return {?}
  12956. */
  12957. NgbTypeahead.prototype._closePopup = /**
  12958. * @private
  12959. * @return {?}
  12960. */
  12961. function () {
  12962. this._closed$.next();
  12963. this._popupService.close();
  12964. this._windowRef = null;
  12965. this.activeDescendant = undefined;
  12966. };
  12967. /**
  12968. * @private
  12969. * @param {?} result
  12970. * @return {?}
  12971. */
  12972. NgbTypeahead.prototype._selectResult = /**
  12973. * @private
  12974. * @param {?} result
  12975. * @return {?}
  12976. */
  12977. function (result) {
  12978. /** @type {?} */
  12979. var defaultPrevented = false;
  12980. this.selectItem.emit({ item: result, preventDefault: (/**
  12981. * @return {?}
  12982. */
  12983. function () { defaultPrevented = true; }) });
  12984. this._resubscribeTypeahead.next(null);
  12985. if (!defaultPrevented) {
  12986. this.writeValue(result);
  12987. this._onChange(result);
  12988. }
  12989. };
  12990. /**
  12991. * @private
  12992. * @param {?} result
  12993. * @return {?}
  12994. */
  12995. NgbTypeahead.prototype._selectResultClosePopup = /**
  12996. * @private
  12997. * @param {?} result
  12998. * @return {?}
  12999. */
  13000. function (result) {
  13001. this._selectResult(result);
  13002. this._closePopup();
  13003. };
  13004. /**
  13005. * @private
  13006. * @return {?}
  13007. */
  13008. NgbTypeahead.prototype._showHint = /**
  13009. * @private
  13010. * @return {?}
  13011. */
  13012. function () {
  13013. if (this.showHint && this._windowRef.instance.hasActive() && this._inputValueBackup != null) {
  13014. /** @type {?} */
  13015. var userInputLowerCase = this._inputValueBackup.toLowerCase();
  13016. /** @type {?} */
  13017. var formattedVal = this._formatItemForInput(this._windowRef.instance.getActive());
  13018. if (userInputLowerCase === formattedVal.substr(0, this._inputValueBackup.length).toLowerCase()) {
  13019. this._writeInputValue(this._inputValueBackup + formattedVal.substr(this._inputValueBackup.length));
  13020. this._elementRef.nativeElement['setSelectionRange'].apply(this._elementRef.nativeElement, [this._inputValueBackup.length, formattedVal.length]);
  13021. }
  13022. else {
  13023. this._writeInputValue(formattedVal);
  13024. }
  13025. }
  13026. };
  13027. /**
  13028. * @private
  13029. * @param {?} item
  13030. * @return {?}
  13031. */
  13032. NgbTypeahead.prototype._formatItemForInput = /**
  13033. * @private
  13034. * @param {?} item
  13035. * @return {?}
  13036. */
  13037. function (item) {
  13038. return item != null && this.inputFormatter ? this.inputFormatter(item) : toString(item);
  13039. };
  13040. /**
  13041. * @private
  13042. * @param {?} value
  13043. * @return {?}
  13044. */
  13045. NgbTypeahead.prototype._writeInputValue = /**
  13046. * @private
  13047. * @param {?} value
  13048. * @return {?}
  13049. */
  13050. function (value) {
  13051. this._renderer.setProperty(this._elementRef.nativeElement, 'value', toString(value));
  13052. };
  13053. /**
  13054. * @private
  13055. * @param {?} userInput$
  13056. * @return {?}
  13057. */
  13058. NgbTypeahead.prototype._subscribeToUserInput = /**
  13059. * @private
  13060. * @param {?} userInput$
  13061. * @return {?}
  13062. */
  13063. function (userInput$) {
  13064. var _this = this;
  13065. return userInput$.subscribe((/**
  13066. * @param {?} results
  13067. * @return {?}
  13068. */
  13069. function (results) {
  13070. if (!results || results.length === 0) {
  13071. _this._closePopup();
  13072. }
  13073. else {
  13074. _this._openPopup();
  13075. _this._windowRef.instance.focusFirst = _this.focusFirst;
  13076. _this._windowRef.instance.results = results;
  13077. _this._windowRef.instance.term = _this._elementRef.nativeElement.value;
  13078. if (_this.resultFormatter) {
  13079. _this._windowRef.instance.formatter = _this.resultFormatter;
  13080. }
  13081. if (_this.resultTemplate) {
  13082. _this._windowRef.instance.resultTemplate = _this.resultTemplate;
  13083. }
  13084. _this._windowRef.instance.resetActive();
  13085. // The observable stream we are subscribing to might have async steps
  13086. // and if a component containing typeahead is using the OnPush strategy
  13087. // the change detection turn wouldn't be invoked automatically.
  13088. _this._windowRef.changeDetectorRef.detectChanges();
  13089. _this._showHint();
  13090. }
  13091. // live announcer
  13092. /** @type {?} */
  13093. var count = results ? results.length : 0;
  13094. _this._live.say(count === 0 ? 'No results available' : count + " result" + (count === 1 ? '' : 's') + " available");
  13095. }));
  13096. };
  13097. /**
  13098. * @private
  13099. * @return {?}
  13100. */
  13101. NgbTypeahead.prototype._unsubscribeFromUserInput = /**
  13102. * @private
  13103. * @return {?}
  13104. */
  13105. function () {
  13106. if (this._subscription) {
  13107. this._subscription.unsubscribe();
  13108. }
  13109. this._subscription = null;
  13110. };
  13111. NgbTypeahead.decorators = [
  13112. { type: core.Directive, args: [{
  13113. selector: 'input[ngbTypeahead]',
  13114. exportAs: 'ngbTypeahead',
  13115. host: {
  13116. '(blur)': 'handleBlur()',
  13117. '[class.open]': 'isPopupOpen()',
  13118. '(keydown)': 'handleKeyDown($event)',
  13119. '[autocomplete]': 'autocomplete',
  13120. 'autocapitalize': 'off',
  13121. 'autocorrect': 'off',
  13122. 'role': 'combobox',
  13123. 'aria-multiline': 'false',
  13124. '[attr.aria-autocomplete]': 'showHint ? "both" : "list"',
  13125. '[attr.aria-activedescendant]': 'activeDescendant',
  13126. '[attr.aria-owns]': 'isPopupOpen() ? popupId : null',
  13127. '[attr.aria-expanded]': 'isPopupOpen()'
  13128. },
  13129. providers: [NGB_TYPEAHEAD_VALUE_ACCESSOR]
  13130. },] }
  13131. ];
  13132. /** @nocollapse */
  13133. NgbTypeahead.ctorParameters = function () { return [
  13134. { type: core.ElementRef },
  13135. { type: core.ViewContainerRef },
  13136. { type: core.Renderer2 },
  13137. { type: core.Injector },
  13138. { type: core.ComponentFactoryResolver },
  13139. { type: NgbTypeaheadConfig },
  13140. { type: core.NgZone },
  13141. { type: Live },
  13142. { type: undefined, decorators: [{ type: core.Inject, args: [common.DOCUMENT,] }] },
  13143. { type: core.NgZone },
  13144. { type: core.ChangeDetectorRef },
  13145. { type: core.ApplicationRef }
  13146. ]; };
  13147. NgbTypeahead.propDecorators = {
  13148. autocomplete: [{ type: core.Input }],
  13149. container: [{ type: core.Input }],
  13150. editable: [{ type: core.Input }],
  13151. focusFirst: [{ type: core.Input }],
  13152. inputFormatter: [{ type: core.Input }],
  13153. ngbTypeahead: [{ type: core.Input }],
  13154. resultFormatter: [{ type: core.Input }],
  13155. resultTemplate: [{ type: core.Input }],
  13156. showHint: [{ type: core.Input }],
  13157. placement: [{ type: core.Input }],
  13158. selectItem: [{ type: core.Output }]
  13159. };
  13160. return NgbTypeahead;
  13161. }());
  13162. /**
  13163. * @fileoverview added by tsickle
  13164. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13165. */
  13166. var NgbTypeaheadModule = /** @class */ (function () {
  13167. function NgbTypeaheadModule() {
  13168. }
  13169. NgbTypeaheadModule.decorators = [
  13170. { type: core.NgModule, args: [{
  13171. declarations: [NgbTypeahead, NgbHighlight, NgbTypeaheadWindow],
  13172. exports: [NgbTypeahead, NgbHighlight],
  13173. imports: [common.CommonModule],
  13174. entryComponents: [NgbTypeaheadWindow]
  13175. },] }
  13176. ];
  13177. return NgbTypeaheadModule;
  13178. }());
  13179. /**
  13180. * @fileoverview added by tsickle
  13181. * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  13182. */
  13183. /** @type {?} */
  13184. var NGB_MODULES = [
  13185. NgbAccordionModule, NgbAlertModule, NgbButtonsModule, NgbCarouselModule, NgbCollapseModule, NgbDatepickerModule,
  13186. NgbDropdownModule, NgbModalModule, NgbNavModule, NgbPaginationModule, NgbPopoverModule, NgbProgressbarModule,
  13187. NgbRatingModule, NgbTabsetModule, NgbTimepickerModule, NgbToastModule, NgbTooltipModule, NgbTypeaheadModule
  13188. ];
  13189. var NgbModule = /** @class */ (function () {
  13190. function NgbModule() {
  13191. }
  13192. NgbModule.decorators = [
  13193. { type: core.NgModule, args: [{ imports: NGB_MODULES, exports: NGB_MODULES },] }
  13194. ];
  13195. return NgbModule;
  13196. }());
  13197. exports.ModalDismissReasons = ModalDismissReasons;
  13198. exports.NgbAccordion = NgbAccordion;
  13199. exports.NgbAccordionConfig = NgbAccordionConfig;
  13200. exports.NgbAccordionModule = NgbAccordionModule;
  13201. exports.NgbActiveModal = NgbActiveModal;
  13202. exports.NgbAlert = NgbAlert;
  13203. exports.NgbAlertConfig = NgbAlertConfig;
  13204. exports.NgbAlertModule = NgbAlertModule;
  13205. exports.NgbButtonLabel = NgbButtonLabel;
  13206. exports.NgbButtonsModule = NgbButtonsModule;
  13207. exports.NgbCalendar = NgbCalendar;
  13208. exports.NgbCalendarGregorian = NgbCalendarGregorian;
  13209. exports.NgbCalendarHebrew = NgbCalendarHebrew;
  13210. exports.NgbCalendarIslamicCivil = NgbCalendarIslamicCivil;
  13211. exports.NgbCalendarIslamicUmalqura = NgbCalendarIslamicUmalqura;
  13212. exports.NgbCalendarPersian = NgbCalendarPersian;
  13213. exports.NgbCarousel = NgbCarousel;
  13214. exports.NgbCarouselConfig = NgbCarouselConfig;
  13215. exports.NgbCarouselModule = NgbCarouselModule;
  13216. exports.NgbCheckBox = NgbCheckBox;
  13217. exports.NgbCollapse = NgbCollapse;
  13218. exports.NgbCollapseModule = NgbCollapseModule;
  13219. exports.NgbDate = NgbDate;
  13220. exports.NgbDateAdapter = NgbDateAdapter;
  13221. exports.NgbDateNativeAdapter = NgbDateNativeAdapter;
  13222. exports.NgbDateNativeUTCAdapter = NgbDateNativeUTCAdapter;
  13223. exports.NgbDateParserFormatter = NgbDateParserFormatter;
  13224. exports.NgbDatepicker = NgbDatepicker;
  13225. exports.NgbDatepickerConfig = NgbDatepickerConfig;
  13226. exports.NgbDatepickerI18n = NgbDatepickerI18n;
  13227. exports.NgbDatepickerI18nHebrew = NgbDatepickerI18nHebrew;
  13228. exports.NgbDatepickerKeyboardService = NgbDatepickerKeyboardService;
  13229. exports.NgbDatepickerModule = NgbDatepickerModule;
  13230. exports.NgbDropdown = NgbDropdown;
  13231. exports.NgbDropdownAnchor = NgbDropdownAnchor;
  13232. exports.NgbDropdownConfig = NgbDropdownConfig;
  13233. exports.NgbDropdownItem = NgbDropdownItem;
  13234. exports.NgbDropdownMenu = NgbDropdownMenu;
  13235. exports.NgbDropdownModule = NgbDropdownModule;
  13236. exports.NgbDropdownToggle = NgbDropdownToggle;
  13237. exports.NgbHighlight = NgbHighlight;
  13238. exports.NgbInputDatepicker = NgbInputDatepicker;
  13239. exports.NgbInputDatepickerConfig = NgbInputDatepickerConfig;
  13240. exports.NgbModal = NgbModal;
  13241. exports.NgbModalConfig = NgbModalConfig;
  13242. exports.NgbModalModule = NgbModalModule;
  13243. exports.NgbModalRef = NgbModalRef;
  13244. exports.NgbModule = NgbModule;
  13245. exports.NgbNav = NgbNav;
  13246. exports.NgbNavConfig = NgbNavConfig;
  13247. exports.NgbNavContent = NgbNavContent;
  13248. exports.NgbNavItem = NgbNavItem;
  13249. exports.NgbNavLink = NgbNavLink;
  13250. exports.NgbNavModule = NgbNavModule;
  13251. exports.NgbNavOutlet = NgbNavOutlet;
  13252. exports.NgbNavbar = NgbNavbar;
  13253. exports.NgbPagination = NgbPagination;
  13254. exports.NgbPaginationConfig = NgbPaginationConfig;
  13255. exports.NgbPaginationEllipsis = NgbPaginationEllipsis;
  13256. exports.NgbPaginationFirst = NgbPaginationFirst;
  13257. exports.NgbPaginationLast = NgbPaginationLast;
  13258. exports.NgbPaginationModule = NgbPaginationModule;
  13259. exports.NgbPaginationNext = NgbPaginationNext;
  13260. exports.NgbPaginationNumber = NgbPaginationNumber;
  13261. exports.NgbPaginationPrevious = NgbPaginationPrevious;
  13262. exports.NgbPanel = NgbPanel;
  13263. exports.NgbPanelContent = NgbPanelContent;
  13264. exports.NgbPanelHeader = NgbPanelHeader;
  13265. exports.NgbPanelTitle = NgbPanelTitle;
  13266. exports.NgbPanelToggle = NgbPanelToggle;
  13267. exports.NgbPopover = NgbPopover;
  13268. exports.NgbPopoverConfig = NgbPopoverConfig;
  13269. exports.NgbPopoverModule = NgbPopoverModule;
  13270. exports.NgbProgressbar = NgbProgressbar;
  13271. exports.NgbProgressbarConfig = NgbProgressbarConfig;
  13272. exports.NgbProgressbarModule = NgbProgressbarModule;
  13273. exports.NgbRadio = NgbRadio;
  13274. exports.NgbRadioGroup = NgbRadioGroup;
  13275. exports.NgbRating = NgbRating;
  13276. exports.NgbRatingConfig = NgbRatingConfig;
  13277. exports.NgbRatingModule = NgbRatingModule;
  13278. exports.NgbSlide = NgbSlide;
  13279. exports.NgbSlideEventDirection = NgbSlideEventDirection;
  13280. exports.NgbSlideEventSource = NgbSlideEventSource;
  13281. exports.NgbTab = NgbTab;
  13282. exports.NgbTabContent = NgbTabContent;
  13283. exports.NgbTabTitle = NgbTabTitle;
  13284. exports.NgbTabset = NgbTabset;
  13285. exports.NgbTabsetConfig = NgbTabsetConfig;
  13286. exports.NgbTabsetModule = NgbTabsetModule;
  13287. exports.NgbTimeAdapter = NgbTimeAdapter;
  13288. exports.NgbTimepicker = NgbTimepicker;
  13289. exports.NgbTimepickerConfig = NgbTimepickerConfig;
  13290. exports.NgbTimepickerI18n = NgbTimepickerI18n;
  13291. exports.NgbTimepickerModule = NgbTimepickerModule;
  13292. exports.NgbToast = NgbToast;
  13293. exports.NgbToastConfig = NgbToastConfig;
  13294. exports.NgbToastHeader = NgbToastHeader;
  13295. exports.NgbToastModule = NgbToastModule;
  13296. exports.NgbTooltip = NgbTooltip;
  13297. exports.NgbTooltipConfig = NgbTooltipConfig;
  13298. exports.NgbTooltipModule = NgbTooltipModule;
  13299. exports.NgbTypeahead = NgbTypeahead;
  13300. exports.NgbTypeaheadConfig = NgbTypeaheadConfig;
  13301. exports.NgbTypeaheadModule = NgbTypeaheadModule;
  13302. exports.ɵa = NGB_CAROUSEL_DIRECTIVES;
  13303. exports.ɵb = NGB_DATEPICKER_CALENDAR_FACTORY;
  13304. exports.ɵba = Live;
  13305. exports.ɵbb = NgbCalendarHijri;
  13306. exports.ɵbc = ContentRef;
  13307. exports.ɵc = NgbDatepickerMonthView;
  13308. exports.ɵd = NgbDatepickerDayView;
  13309. exports.ɵe = NgbDatepickerNavigation;
  13310. exports.ɵf = NgbDatepickerNavigationSelect;
  13311. exports.ɵg = NGB_DATEPICKER_18N_FACTORY;
  13312. exports.ɵh = NgbDatepickerI18nDefault;
  13313. exports.ɵi = NGB_DATEPICKER_DATE_ADAPTER_FACTORY;
  13314. exports.ɵj = NgbDateStructAdapter;
  13315. exports.ɵk = NGB_DATEPICKER_PARSER_FORMATTER_FACTORY;
  13316. exports.ɵl = NgbDateISOParserFormatter;
  13317. exports.ɵm = NgbPopoverWindow;
  13318. exports.ɵn = NGB_DATEPICKER_TIME_ADAPTER_FACTORY;
  13319. exports.ɵo = NgbTimeStructAdapter;
  13320. exports.ɵp = NGB_TIMEPICKER_I18N_FACTORY;
  13321. exports.ɵq = NgbTimepickerI18nDefault;
  13322. exports.ɵr = NgbTooltipWindow;
  13323. exports.ɵs = NgbTypeaheadWindow;
  13324. exports.ɵt = NgbDatepickerService;
  13325. exports.ɵu = NgbModalBackdrop;
  13326. exports.ɵv = NgbModalWindow;
  13327. exports.ɵw = NgbModalStack;
  13328. exports.ɵx = ScrollBar;
  13329. exports.ɵy = ARIA_LIVE_DELAY;
  13330. exports.ɵz = ARIA_LIVE_DELAY_FACTORY;
  13331. Object.defineProperty(exports, '__esModule', { value: true });
  13332. }));
  13333. //# sourceMappingURL=ng-bootstrap.umd.js.map