Bez popisu

index.js 673KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory();
  4. else if(typeof define === 'function' && define.amd)
  5. define([], factory);
  6. else {
  7. var a = factory();
  8. for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
  9. }
  10. })(window, function() {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = "./src/index.ts");
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/drawboard/Drawboard/index.less":
  99. /*!*********************************************************************************************************************************************************************************!*\
  100. !*** ./node_modules/css-loader/dist/cjs.js??ref--11-1!./node_modules/postcss-loader/src!./node_modules/less-loader/dist/cjs.js??ref--11-3!./src/drawboard/Drawboard/index.less ***!
  101. \*********************************************************************************************************************************************************************************/
  102. /*! no static exports found */
  103. /***/ (function(module, exports, __webpack_require__) {
  104. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js")(false);
  105. // Module
  106. exports.push([module.i, ".fc-whiteboard-logo {\n display: inline-block;\n margin: 0px;\n padding: 0px;\n fill: #333333;\n}\n.fc-whiteboard-logo a {\n display: grid;\n -ms-flex-align: center;\n align-items: center;\n justify-items: center;\n padding: 3px;\n width: 20px;\n height: 20px;\n}\n.fc-whiteboard-logo a:hover {\n fill: #ff8080;\n}\n.fc-whiteboard-text-editor {\n position: fixed;\n z-index: 20000;\n left: 0px;\n top: 0px;\n width: 100vw;\n height: 100vh;\n background-color: rgba(0, 0, 0, 0.9);\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: column;\n flex-direction: column;\n -ms-flex-align: center;\n align-items: center;\n -ms-flex-pack: center;\n justify-content: center;\n}\n.fc-whiteboard-text-editor textarea {\n width: 50%;\n min-width: 50px;\n max-width: 500px;\n height: 50%;\n min-height: 50px;\n max-height: 500px;\n}\n.fc-whiteboard-text-editor .fc-whiteboard-text-editor-button-bar {\n display: -ms-flexbox;\n display: flex;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-pack: end;\n justify-content: flex-end;\n width: 50%;\n min-width: 50px;\n max-width: 500px;\n padding-top: 10px;\n}\n.fc-whiteboard-text-editor .fc-whiteboard-text-editor-button {\n display: grid;\n -ms-flex-align: center;\n align-items: center;\n padding: 0px;\n margin-left: 15px;\n width: 20px;\n height: 20px;\n cursor: pointer;\n fill: #888888;\n}\n.fc-whiteboard-text-editor .fc-whiteboard-text-editor-button:hover {\n fill: #ff8080;\n}\n", ""]);
  107. /***/ }),
  108. /***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/toolbar/index.less":
  109. /*!*********************************************************************************************************************************************************************!*\
  110. !*** ./node_modules/css-loader/dist/cjs.js??ref--11-1!./node_modules/postcss-loader/src!./node_modules/less-loader/dist/cjs.js??ref--11-3!./src/toolbar/index.less ***!
  111. \*********************************************************************************************************************************************************************/
  112. /*! no static exports found */
  113. /***/ (function(module, exports, __webpack_require__) {
  114. exports = module.exports = __webpack_require__(/*! ../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js")(false);
  115. // Module
  116. exports.push([module.i, ".fc-whiteboard-toolbar {\n height: 36px;\n background: #ffffff;\n -webkit-box-shadow: 0px 2px 9px 0px rgba(194, 185, 187, 0.29);\n box-shadow: 0px 2px 9px 0px rgba(194, 185, 187, 0.29);\n border-radius: 13px;\n opacity: 0.9;\n border: 1px solid #e6ecf7;\n padding: 0 8px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-align: center;\n align-items: center;\n}\n.fc-whiteboard-toolbar-button,\n.fc-whiteboard-toolbar-logo a {\n display: inline-block;\n margin: 2px;\n padding: 3px;\n cursor: pointer;\n width: 20px;\n height: 20px;\n border-radius: 2px;\n border-bottom: transparent solid 1px;\n border-right: transparent solid 1px;\n fill: #333333;\n display: grid;\n -ms-flex-align: center;\n align-items: center;\n justify-items: center;\n}\n.fc-whiteboard-toolbar-separator {\n width: 0px;\n height: 20px;\n margin: 5px 5px;\n border: 1px solid #cad3df;\n}\n.fc-whiteboard-toolbar-button:hover,\n.fc-whiteboard-toolbar-logo a:hover {\n background-color: #eeeeee;\n background: -webkit-radial-gradient(#eeeeee, #cccccc);\n background: -o-radial-gradient(#eeeeee, #cccccc);\n background: radial-gradient(#eeeeee, #cccccc);\n fill: #ff8080;\n}\n.fc-whiteboard-toolbar-button svg {\n height: 16px;\n}\n.fc-whiteboard-indicator-container {\n font-size: 13px;\n line-height: 27px;\n height: 27px;\n width: 40px;\n display: -ms-flexbox;\n display: flex;\n -ms-flex-pack: center;\n justify-content: center;\n letter-spacing: 2;\n}\n", ""]);
  117. /***/ }),
  118. /***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/whiteboard/AbstractWhiteboard/index.less":
  119. /*!*******************************************************************************************************************************************************************************************!*\
  120. !*** ./node_modules/css-loader/dist/cjs.js??ref--11-1!./node_modules/postcss-loader/src!./node_modules/less-loader/dist/cjs.js??ref--11-3!./src/whiteboard/AbstractWhiteboard/index.less ***!
  121. \*******************************************************************************************************************************************************************************************/
  122. /*! no static exports found */
  123. /***/ (function(module, exports, __webpack_require__) {
  124. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js")(false);
  125. // Module
  126. exports.push([module.i, ".fcw-board {\n position: relative;\n}\n.fcw-board-imgs,\n.fcw-board-pages,\n.fcw-board .fcw-page {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n}\n.fcw-board-imgs > div,\n.fcw-board-imgs > div > div {\n height: 100%;\n}\n.fcw-board-img {\n width: 100%;\n height: 100%;\n}\n.fcw-board-img-wrapper {\n background-image: url(https://i.postimg.cc/RZwf0MRw/image.png);\n background-size: contain;\n background-position: center;\n height: 100%;\n width: 100%;\n background-repeat: no-repeat;\n}\n.fcw-board-flip-arrow {\n height: 20px;\n width: 20px;\n cursor: pointer;\n}\n.fcw-board-controller {\n position: absolute;\n display: -ms-flexbox;\n display: flex;\n width: 50px;\n height: 30px;\n -ms-flex-pack: justify;\n justify-content: space-between;\n -ms-flex-align: center;\n align-items: center;\n top: -30px;\n background-color: #cccccc;\n padding: 0px 5px;\n margin: 0px;\n border-top-left-radius: 10px;\n border-top-right-radius: 10px;\n}\n", ""]);
  127. /***/ }),
  128. /***/ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/whiteboard/WhitePage/index.less":
  129. /*!**********************************************************************************************************************************************************************************!*\
  130. !*** ./node_modules/css-loader/dist/cjs.js??ref--11-1!./node_modules/postcss-loader/src!./node_modules/less-loader/dist/cjs.js??ref--11-3!./src/whiteboard/WhitePage/index.less ***!
  131. \**********************************************************************************************************************************************************************************/
  132. /*! no static exports found */
  133. /***/ (function(module, exports, __webpack_require__) {
  134. exports = module.exports = __webpack_require__(/*! ../../../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js")(false);
  135. // Module
  136. exports.push([module.i, ".fcw-page img {\n width: 100%;\n height: 100%;\n}\n", ""]);
  137. /***/ }),
  138. /***/ "./node_modules/css-loader/dist/runtime/api.js":
  139. /*!*****************************************************!*\
  140. !*** ./node_modules/css-loader/dist/runtime/api.js ***!
  141. \*****************************************************/
  142. /*! no static exports found */
  143. /***/ (function(module, exports, __webpack_require__) {
  144. "use strict";
  145. /*
  146. MIT License http://www.opensource.org/licenses/mit-license.php
  147. Author Tobias Koppers @sokra
  148. */
  149. // css base code, injected by the css-loader
  150. module.exports = function (useSourceMap) {
  151. var list = []; // return the list of modules as css string
  152. list.toString = function toString() {
  153. return this.map(function (item) {
  154. var content = cssWithMappingToString(item, useSourceMap);
  155. if (item[2]) {
  156. return '@media ' + item[2] + '{' + content + '}';
  157. } else {
  158. return content;
  159. }
  160. }).join('');
  161. }; // import a list of modules into the list
  162. list.i = function (modules, mediaQuery) {
  163. if (typeof modules === 'string') {
  164. modules = [[null, modules, '']];
  165. }
  166. var alreadyImportedModules = {};
  167. for (var i = 0; i < this.length; i++) {
  168. var id = this[i][0];
  169. if (id != null) {
  170. alreadyImportedModules[id] = true;
  171. }
  172. }
  173. for (i = 0; i < modules.length; i++) {
  174. var item = modules[i]; // skip already imported module
  175. // this implementation is not 100% perfect for weird media query combinations
  176. // when a module is imported multiple times with different media queries.
  177. // I hope this will never occur (Hey this way we have smaller bundles)
  178. if (item[0] == null || !alreadyImportedModules[item[0]]) {
  179. if (mediaQuery && !item[2]) {
  180. item[2] = mediaQuery;
  181. } else if (mediaQuery) {
  182. item[2] = '(' + item[2] + ') and (' + mediaQuery + ')';
  183. }
  184. list.push(item);
  185. }
  186. }
  187. };
  188. return list;
  189. };
  190. function cssWithMappingToString(item, useSourceMap) {
  191. var content = item[1] || '';
  192. var cssMapping = item[3];
  193. if (!cssMapping) {
  194. return content;
  195. }
  196. if (useSourceMap && typeof btoa === 'function') {
  197. var sourceMapping = toComment(cssMapping);
  198. var sourceURLs = cssMapping.sources.map(function (source) {
  199. return '/*# sourceURL=' + cssMapping.sourceRoot + source + ' */';
  200. });
  201. return [content].concat(sourceURLs).concat([sourceMapping]).join('\n');
  202. }
  203. return [content].join('\n');
  204. } // Adapted from convert-source-map (MIT)
  205. function toComment(sourceMap) {
  206. // eslint-disable-next-line no-undef
  207. var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap))));
  208. var data = 'sourceMappingURL=data:application/json;charset=utf-8;base64,' + base64;
  209. return '/*# ' + data + ' */';
  210. }
  211. /***/ }),
  212. /***/ "./node_modules/eventemitter3/index.js":
  213. /*!*********************************************!*\
  214. !*** ./node_modules/eventemitter3/index.js ***!
  215. \*********************************************/
  216. /*! no static exports found */
  217. /***/ (function(module, exports, __webpack_require__) {
  218. "use strict";
  219. var has = Object.prototype.hasOwnProperty
  220. , prefix = '~';
  221. /**
  222. * Constructor to create a storage for our `EE` objects.
  223. * An `Events` instance is a plain object whose properties are event names.
  224. *
  225. * @constructor
  226. * @private
  227. */
  228. function Events() {}
  229. //
  230. // We try to not inherit from `Object.prototype`. In some engines creating an
  231. // instance in this way is faster than calling `Object.create(null)` directly.
  232. // If `Object.create(null)` is not supported we prefix the event names with a
  233. // character to make sure that the built-in object properties are not
  234. // overridden or used as an attack vector.
  235. //
  236. if (Object.create) {
  237. Events.prototype = Object.create(null);
  238. //
  239. // This hack is needed because the `__proto__` property is still inherited in
  240. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  241. //
  242. if (!new Events().__proto__) prefix = false;
  243. }
  244. /**
  245. * Representation of a single event listener.
  246. *
  247. * @param {Function} fn The listener function.
  248. * @param {*} context The context to invoke the listener with.
  249. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  250. * @constructor
  251. * @private
  252. */
  253. function EE(fn, context, once) {
  254. this.fn = fn;
  255. this.context = context;
  256. this.once = once || false;
  257. }
  258. /**
  259. * Add a listener for a given event.
  260. *
  261. * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
  262. * @param {(String|Symbol)} event The event name.
  263. * @param {Function} fn The listener function.
  264. * @param {*} context The context to invoke the listener with.
  265. * @param {Boolean} once Specify if the listener is a one-time listener.
  266. * @returns {EventEmitter}
  267. * @private
  268. */
  269. function addListener(emitter, event, fn, context, once) {
  270. if (typeof fn !== 'function') {
  271. throw new TypeError('The listener must be a function');
  272. }
  273. var listener = new EE(fn, context || emitter, once)
  274. , evt = prefix ? prefix + event : event;
  275. if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++;
  276. else if (!emitter._events[evt].fn) emitter._events[evt].push(listener);
  277. else emitter._events[evt] = [emitter._events[evt], listener];
  278. return emitter;
  279. }
  280. /**
  281. * Clear event by name.
  282. *
  283. * @param {EventEmitter} emitter Reference to the `EventEmitter` instance.
  284. * @param {(String|Symbol)} evt The Event name.
  285. * @private
  286. */
  287. function clearEvent(emitter, evt) {
  288. if (--emitter._eventsCount === 0) emitter._events = new Events();
  289. else delete emitter._events[evt];
  290. }
  291. /**
  292. * Minimal `EventEmitter` interface that is molded against the Node.js
  293. * `EventEmitter` interface.
  294. *
  295. * @constructor
  296. * @public
  297. */
  298. function EventEmitter() {
  299. this._events = new Events();
  300. this._eventsCount = 0;
  301. }
  302. /**
  303. * Return an array listing the events for which the emitter has registered
  304. * listeners.
  305. *
  306. * @returns {Array}
  307. * @public
  308. */
  309. EventEmitter.prototype.eventNames = function eventNames() {
  310. var names = []
  311. , events
  312. , name;
  313. if (this._eventsCount === 0) return names;
  314. for (name in (events = this._events)) {
  315. if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  316. }
  317. if (Object.getOwnPropertySymbols) {
  318. return names.concat(Object.getOwnPropertySymbols(events));
  319. }
  320. return names;
  321. };
  322. /**
  323. * Return the listeners registered for a given event.
  324. *
  325. * @param {(String|Symbol)} event The event name.
  326. * @returns {Array} The registered listeners.
  327. * @public
  328. */
  329. EventEmitter.prototype.listeners = function listeners(event) {
  330. var evt = prefix ? prefix + event : event
  331. , handlers = this._events[evt];
  332. if (!handlers) return [];
  333. if (handlers.fn) return [handlers.fn];
  334. for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
  335. ee[i] = handlers[i].fn;
  336. }
  337. return ee;
  338. };
  339. /**
  340. * Return the number of listeners listening to a given event.
  341. *
  342. * @param {(String|Symbol)} event The event name.
  343. * @returns {Number} The number of listeners.
  344. * @public
  345. */
  346. EventEmitter.prototype.listenerCount = function listenerCount(event) {
  347. var evt = prefix ? prefix + event : event
  348. , listeners = this._events[evt];
  349. if (!listeners) return 0;
  350. if (listeners.fn) return 1;
  351. return listeners.length;
  352. };
  353. /**
  354. * Calls each of the listeners registered for a given event.
  355. *
  356. * @param {(String|Symbol)} event The event name.
  357. * @returns {Boolean} `true` if the event had listeners, else `false`.
  358. * @public
  359. */
  360. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  361. var evt = prefix ? prefix + event : event;
  362. if (!this._events[evt]) return false;
  363. var listeners = this._events[evt]
  364. , len = arguments.length
  365. , args
  366. , i;
  367. if (listeners.fn) {
  368. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  369. switch (len) {
  370. case 1: return listeners.fn.call(listeners.context), true;
  371. case 2: return listeners.fn.call(listeners.context, a1), true;
  372. case 3: return listeners.fn.call(listeners.context, a1, a2), true;
  373. case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
  374. case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  375. case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  376. }
  377. for (i = 1, args = new Array(len -1); i < len; i++) {
  378. args[i - 1] = arguments[i];
  379. }
  380. listeners.fn.apply(listeners.context, args);
  381. } else {
  382. var length = listeners.length
  383. , j;
  384. for (i = 0; i < length; i++) {
  385. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  386. switch (len) {
  387. case 1: listeners[i].fn.call(listeners[i].context); break;
  388. case 2: listeners[i].fn.call(listeners[i].context, a1); break;
  389. case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
  390. case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
  391. default:
  392. if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
  393. args[j - 1] = arguments[j];
  394. }
  395. listeners[i].fn.apply(listeners[i].context, args);
  396. }
  397. }
  398. }
  399. return true;
  400. };
  401. /**
  402. * Add a listener for a given event.
  403. *
  404. * @param {(String|Symbol)} event The event name.
  405. * @param {Function} fn The listener function.
  406. * @param {*} [context=this] The context to invoke the listener with.
  407. * @returns {EventEmitter} `this`.
  408. * @public
  409. */
  410. EventEmitter.prototype.on = function on(event, fn, context) {
  411. return addListener(this, event, fn, context, false);
  412. };
  413. /**
  414. * Add a one-time listener for a given event.
  415. *
  416. * @param {(String|Symbol)} event The event name.
  417. * @param {Function} fn The listener function.
  418. * @param {*} [context=this] The context to invoke the listener with.
  419. * @returns {EventEmitter} `this`.
  420. * @public
  421. */
  422. EventEmitter.prototype.once = function once(event, fn, context) {
  423. return addListener(this, event, fn, context, true);
  424. };
  425. /**
  426. * Remove the listeners of a given event.
  427. *
  428. * @param {(String|Symbol)} event The event name.
  429. * @param {Function} fn Only remove the listeners that match this function.
  430. * @param {*} context Only remove the listeners that have this context.
  431. * @param {Boolean} once Only remove one-time listeners.
  432. * @returns {EventEmitter} `this`.
  433. * @public
  434. */
  435. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  436. var evt = prefix ? prefix + event : event;
  437. if (!this._events[evt]) return this;
  438. if (!fn) {
  439. clearEvent(this, evt);
  440. return this;
  441. }
  442. var listeners = this._events[evt];
  443. if (listeners.fn) {
  444. if (
  445. listeners.fn === fn &&
  446. (!once || listeners.once) &&
  447. (!context || listeners.context === context)
  448. ) {
  449. clearEvent(this, evt);
  450. }
  451. } else {
  452. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  453. if (
  454. listeners[i].fn !== fn ||
  455. (once && !listeners[i].once) ||
  456. (context && listeners[i].context !== context)
  457. ) {
  458. events.push(listeners[i]);
  459. }
  460. }
  461. //
  462. // Reset the array, or remove it completely if we have no more listeners.
  463. //
  464. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
  465. else clearEvent(this, evt);
  466. }
  467. return this;
  468. };
  469. /**
  470. * Remove all listeners, or those of the specified event.
  471. *
  472. * @param {(String|Symbol)} [event] The event name.
  473. * @returns {EventEmitter} `this`.
  474. * @public
  475. */
  476. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  477. var evt;
  478. if (event) {
  479. evt = prefix ? prefix + event : event;
  480. if (this._events[evt]) clearEvent(this, evt);
  481. } else {
  482. this._events = new Events();
  483. this._eventsCount = 0;
  484. }
  485. return this;
  486. };
  487. //
  488. // Alias methods names because people roll like that.
  489. //
  490. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  491. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  492. //
  493. // Expose the prefix.
  494. //
  495. EventEmitter.prefixed = prefix;
  496. //
  497. // Allow `EventEmitter` to be imported as module namespace.
  498. //
  499. EventEmitter.EventEmitter = EventEmitter;
  500. //
  501. // Expose the module.
  502. //
  503. if (true) {
  504. module.exports = EventEmitter;
  505. }
  506. /***/ }),
  507. /***/ "./node_modules/fc-hotkeys/dist/index.js":
  508. /*!***********************************************!*\
  509. !*** ./node_modules/fc-hotkeys/dist/index.js ***!
  510. \***********************************************/
  511. /*! no static exports found */
  512. /***/ (function(module, exports, __webpack_require__) {
  513. !function(t,e){if(true)module.exports=e();else { var r, n; }}(window,function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.KEY_ESC="ESC",e.KEY_ALL="*",e.normalizeModifiersMap={ctrl:"Ctrl",control:"Ctrl",alt:"Alt",shift:"Shift",command:"Command",meta:"Command"}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}(n(0));var r=n(2);e.HotkeysListener=r.default},function(t,e,n){"use strict";var r,o=this&&this.__extends||(r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});Object.defineProperty(e,"__esModule",{value:!0});var i=n(3),a=n(0),s=n(4),c=function(){function t(t,e){var n=this;void 0===t&&(t=document.body),void 0===e&&(e=i),this.listeners={},this._notify=function(t,e,r){var o=n.listeners[a.KEY_ALL];o&&o.length>0&&o.forEach(function(t){!1===t(e,r)&&s.preventAndStopEvent(e)});var i=n.listeners[t];i&&i.length>0&&i.forEach(function(t){!1===t(e,r)&&s.preventAndStopEvent(e)})};var r=this._notify,c=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o(e,t),e.prototype.handleKey=function(t,e,n){var o=s.normalizeHotkeys(t,e);n&&"keyup"!==n.type&&r(o,n,{char:t,modifiers:e,hotkey:o})},e}(e);this.trapObj=new c(t)}return t.prototype.on=function(t,e){var n=this;if("string"==typeof t){var r=t,o=this.listeners[r]||[];o.push(e),this.listeners[r]=o}else{if(!Array.isArray(t))throw new Error("first param of on() must be a string or an array of string");t.forEach(function(t){n.on(t,e)})}},t.prototype.off=function(t,e){var n=this;if("string"==typeof t){var r=t,o=this.listeners[r]||[],i=o.indexOf(e);i>=0&&o.splice(i,1),this.listeners[r]=o}else{if(!Array.isArray(t))throw new Error("first param of off() must be a string or an array of string");t.forEach(function(t){n.off(t,e)})}},t.prototype.reset=function(){this.listeners={},this.trapObj.reset()},t}();e.default=c},function(t,e,n){var r;!function(o,i,a){if(o){for(var s,c={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},u={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},f={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},l={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},p=1;p<20;++p)c[111+p]="f"+p;for(p=0;p<=9;++p)c[p+96]=p.toString();b.prototype.bind=function(t,e,n){return t=t instanceof Array?t:[t],this._bindMultiple.call(this,t,e,n),this},b.prototype.unbind=function(t,e){return this.bind.call(this,t,function(){},e)},b.prototype.trigger=function(t,e){return this._directMap[t+":"+e]&&this._directMap[t+":"+e]({},t),this},b.prototype.reset=function(){return this._callbacks={},this._directMap={},this},b.prototype.stopCallback=function(t,e){if((" "+e.className+" ").indexOf(" mousetrap ")>-1)return!1;if(function t(e,n){return null!==e&&e!==i&&(e===n||t(e.parentNode,n))}(e,this.target))return!1;if("composedPath"in t&&"function"==typeof t.composedPath){var n=t.composedPath()[0];n!==t.target&&(e=n)}return"INPUT"==e.tagName||"SELECT"==e.tagName||"TEXTAREA"==e.tagName||e.isContentEditable},b.prototype.handleKey=function(){return this._handleKey.apply(this,arguments)},b.addKeycodes=function(t){for(var e in t)t.hasOwnProperty(e)&&(c[e]=t[e]);s=null},b.init=function(){var t=b(i);for(var e in t)"_"!==e.charAt(0)&&(b[e]=function(e){return function(){return t[e].apply(t,arguments)}}(e))},b.init(),o.Mousetrap=b,t.exports&&(t.exports=b),void 0===(r=function(){return b}.call(e,n,e,t))||(t.exports=r)}function h(t,e,n){t.addEventListener?t.addEventListener(e,n,!1):t.attachEvent("on"+e,n)}function d(t){if("keypress"==t.type){var e=String.fromCharCode(t.which);return t.shiftKey||(e=e.toLowerCase()),e}return c[t.which]?c[t.which]:u[t.which]?u[t.which]:String.fromCharCode(t.which).toLowerCase()}function y(t){return"shift"==t||"ctrl"==t||"alt"==t||"meta"==t}function v(t,e,n){return n||(n=function(){if(!s)for(var t in s={},c)t>95&&t<112||c.hasOwnProperty(t)&&(s[c[t]]=t);return s}()[t]?"keydown":"keypress"),"keypress"==n&&e.length&&(n="keydown"),n}function m(t,e){var n,r,o,i=[];for(n=function(t){return"+"===t?["+"]:(t=t.replace(/\+{2}/g,"+plus")).split("+")}(t),o=0;o<n.length;++o)r=n[o],l[r]&&(r=l[r]),e&&"keypress"!=e&&f[r]&&(r=f[r],i.push("shift")),y(r)&&i.push(r);return{key:r,modifiers:i,action:e=v(r,i,e)}}function b(t){var e=this;if(t=t||i,!(e instanceof b))return new b(t);e.target=t,e._callbacks={},e._directMap={};var n,r={},o=!1,a=!1,s=!1;function c(t){t=t||{};var e,n=!1;for(e in r)t[e]?n=!0:r[e]=0;n||(s=!1)}function u(t,n,o,i,a,s){var c,u,f,l,p=[],h=o.type;if(!e._callbacks[t])return[];for("keyup"==h&&y(t)&&(n=[t]),c=0;c<e._callbacks[t].length;++c)if(u=e._callbacks[t][c],(i||!u.seq||r[u.seq]==u.level)&&h==u.action&&("keypress"==h&&!o.metaKey&&!o.ctrlKey||(f=n,l=u.modifiers,f.sort().join(",")===l.sort().join(",")))){var d=!i&&u.combo==a,v=i&&u.seq==i&&u.level==s;(d||v)&&e._callbacks[t].splice(c,1),p.push(u)}return p}function f(t,n,r,o){e.stopCallback(n,n.target||n.srcElement,r,o)||!1===t(n,r)&&(function(t){t.preventDefault?t.preventDefault():t.returnValue=!1}(n),function(t){t.stopPropagation?t.stopPropagation():t.cancelBubble=!0}(n))}function l(t){"number"!=typeof t.which&&(t.which=t.keyCode);var n=d(t);n&&("keyup"!=t.type||o!==n?e.handleKey(n,function(t){var e=[];return t.shiftKey&&e.push("shift"),t.altKey&&e.push("alt"),t.ctrlKey&&e.push("ctrl"),t.metaKey&&e.push("meta"),e}(t),t):o=!1)}function p(t,e,i,a){function u(e){return function(){s=e,++r[t],clearTimeout(n),n=setTimeout(c,1e3)}}function l(e){f(i,e,t),"keyup"!==a&&(o=d(e)),setTimeout(c,10)}r[t]=0;for(var p=0;p<e.length;++p){var h=p+1===e.length?l:u(a||m(e[p+1]).action);v(e[p],h,a,t,p)}}function v(t,n,r,o,i){e._directMap[t+":"+r]=n;var a,s=(t=t.replace(/\s+/g," ")).split(" ");s.length>1?p(t,s,n,r):(a=m(t,r),e._callbacks[a.key]=e._callbacks[a.key]||[],u(a.key,a.modifiers,{type:a.action},o,t,i),e._callbacks[a.key][o?"unshift":"push"]({callback:n,modifiers:a.modifiers,action:a.action,seq:o,level:i,combo:t}))}e._handleKey=function(t,e,n){var r,o=u(t,e,n),i={},l=0,p=!1;for(r=0;r<o.length;++r)o[r].seq&&(l=Math.max(l,o[r].level));for(r=0;r<o.length;++r)if(o[r].seq){if(o[r].level!=l)continue;p=!0,i[o[r].seq]=1,f(o[r].callback,n,o[r].combo,o[r].seq)}else p||f(o[r].callback,n,o[r].combo);var h="keypress"==n.type&&a;n.type!=s||y(t)||h||c(i),a=p&&"keydown"==n.type},e._bindMultiple=function(t,e,n){for(var r=0;r<t.length;++r)v(t[r],e,n)},h(t,"keypress",l),h(t,"keydown",l),h(t,"keyup",l)}}("undefined"!=typeof window?window:null,"undefined"!=typeof window?document:null)},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(0);e.normalizeHotkeys=function(t,e){var n=e.map(function(t){return r.normalizeModifiersMap[t]||t}).reverse();return e.indexOf(t)<0&&n.indexOf(t)<0&&n.push(t.toUpperCase()),n.join("+")},e.preventAndStopEvent=function(t){t.preventDefault(),t.stopPropagation()}}])});
  514. /***/ }),
  515. /***/ "./node_modules/interactjs/dist/interact.js":
  516. /*!**************************************************!*\
  517. !*** ./node_modules/interactjs/dist/interact.js ***!
  518. \**************************************************/
  519. /*! no static exports found */
  520. /***/ (function(module, exports, __webpack_require__) {
  521. /**
  522. * interact.js 1.4.9
  523. *
  524. * Copyright (c) 2012-2019 Taye Adeyemi <dev@taye.me>
  525. * Released under the MIT License.
  526. * https://raw.github.com/taye/interact.js/master/LICENSE
  527. */
  528. (function(f){if(true){module.exports=f()}else { var g; }})(function(){var define,module,exports;
  529. var createModuleFactory = function createModuleFactory(t){var e;return function(r){return e||t(e={exports:{},parent:r},e.exports),e.exports}};
  530. var _$scope_24 = createModuleFactory(function (module, exports) {
  531. "use strict";
  532. Object.defineProperty(exports, "__esModule", {
  533. value: true
  534. });
  535. /* common-shake removed: exports.createScope = */ void createScope;
  536. /* common-shake removed: exports.initScope = */ void initScope;
  537. exports.Scope = exports.ActionName = void 0;
  538. var utils = _interopRequireWildcard(_$utils_55);
  539. var _domObjects = _interopRequireDefault(_$domObjects_49);
  540. var _defaultOptions = _interopRequireDefault(_$defaultOptions_20);
  541. var _Eventable = _interopRequireDefault(_$Eventable_14);
  542. var _Interactable = _interopRequireDefault(_$Interactable_16);
  543. var _InteractableSet = _interopRequireDefault(_$InteractableSet_17);
  544. var _InteractEvent = _interopRequireDefault(_$InteractEvent_15);
  545. var _interactions = _interopRequireDefault(_$interactions_23({}));
  546. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  547. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  548. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  549. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  550. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  551. function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }
  552. function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
  553. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  554. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  555. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  556. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  557. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  558. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  559. var win = utils.win,
  560. browser = utils.browser,
  561. raf = utils.raf,
  562. Signals = utils.Signals,
  563. events = utils.events;
  564. var ActionName;
  565. exports.ActionName = ActionName;
  566. (function (ActionName) {})(ActionName || (exports.ActionName = ActionName = {}));
  567. function createScope() {
  568. return new Scope();
  569. }
  570. var Scope =
  571. /*#__PURE__*/
  572. function () {
  573. function Scope() {
  574. var _this = this;
  575. _classCallCheck(this, Scope);
  576. this.id = "__interact_scope_".concat(Math.floor(Math.random() * 100));
  577. this.signals = new Signals();
  578. this.browser = browser;
  579. this.events = events;
  580. this.utils = utils;
  581. this.defaults = utils.clone(_defaultOptions["default"]);
  582. this.Eventable = _Eventable["default"];
  583. this.actions = {
  584. names: [],
  585. methodDict: {},
  586. eventTypes: []
  587. };
  588. this.InteractEvent = _InteractEvent["default"];
  589. this.interactables = new _InteractableSet["default"](this); // all documents being listened to
  590. this.documents = [];
  591. this._plugins = [];
  592. this._pluginMap = {};
  593. this.onWindowUnload = function (event) {
  594. return _this.removeDocument(event.target);
  595. };
  596. var scope = this;
  597. this.Interactable =
  598. /*#__PURE__*/
  599. function (_InteractableBase) {
  600. _inherits(Interactable, _InteractableBase);
  601. function Interactable() {
  602. _classCallCheck(this, Interactable);
  603. return _possibleConstructorReturn(this, _getPrototypeOf(Interactable).apply(this, arguments));
  604. }
  605. _createClass(Interactable, [{
  606. key: "set",
  607. value: function set(options) {
  608. _get(_getPrototypeOf(Interactable.prototype), "set", this).call(this, options);
  609. scope.interactables.signals.fire('set', {
  610. options: options,
  611. interactable: this
  612. });
  613. return this;
  614. }
  615. }, {
  616. key: "unset",
  617. value: function unset() {
  618. _get(_getPrototypeOf(Interactable.prototype), "unset", this).call(this);
  619. for (var i = scope.interactions.list.length - 1; i >= 0; i--) {
  620. var interaction = scope.interactions.list[i];
  621. if (interaction.interactable === this) {
  622. interaction.stop();
  623. scope.interactions.signals.fire('destroy', {
  624. interaction: interaction
  625. });
  626. interaction.destroy();
  627. if (scope.interactions.list.length > 2) {
  628. scope.interactions.list.splice(i, 1);
  629. }
  630. }
  631. }
  632. scope.interactables.signals.fire('unset', {
  633. interactable: this
  634. });
  635. }
  636. }, {
  637. key: "_defaults",
  638. get: function get() {
  639. return scope.defaults;
  640. }
  641. }]);
  642. return Interactable;
  643. }(_Interactable["default"]);
  644. }
  645. _createClass(Scope, [{
  646. key: "init",
  647. value: function init(window) {
  648. return initScope(this, window);
  649. }
  650. }, {
  651. key: "pluginIsInstalled",
  652. value: function pluginIsInstalled(plugin) {
  653. return this._pluginMap[plugin.id] || this._plugins.indexOf(plugin) !== -1;
  654. }
  655. }, {
  656. key: "usePlugin",
  657. value: function usePlugin(plugin, options) {
  658. if (this.pluginIsInstalled(plugin)) {
  659. return this;
  660. }
  661. if (plugin.id) {
  662. this._pluginMap[plugin.id] = plugin;
  663. }
  664. plugin.install(this, options);
  665. this._plugins.push(plugin);
  666. return this;
  667. }
  668. }, {
  669. key: "addDocument",
  670. value: function addDocument(doc, options) {
  671. // do nothing if document is already known
  672. if (this.getDocIndex(doc) !== -1) {
  673. return false;
  674. }
  675. var window = win.getWindow(doc);
  676. options = options ? utils.extend({}, options) : {};
  677. this.documents.push({
  678. doc: doc,
  679. options: options
  680. });
  681. events.documents.push(doc); // don't add an unload event for the main document
  682. // so that the page may be cached in browser history
  683. if (doc !== this.document) {
  684. events.add(window, 'unload', this.onWindowUnload);
  685. }
  686. this.signals.fire('add-document', {
  687. doc: doc,
  688. window: window,
  689. scope: this,
  690. options: options
  691. });
  692. }
  693. }, {
  694. key: "removeDocument",
  695. value: function removeDocument(doc) {
  696. var index = this.getDocIndex(doc);
  697. var window = win.getWindow(doc);
  698. var options = this.documents[index].options;
  699. events.remove(window, 'unload', this.onWindowUnload);
  700. this.documents.splice(index, 1);
  701. events.documents.splice(index, 1);
  702. this.signals.fire('remove-document', {
  703. doc: doc,
  704. window: window,
  705. scope: this,
  706. options: options
  707. });
  708. }
  709. }, {
  710. key: "getDocIndex",
  711. value: function getDocIndex(doc) {
  712. for (var i = 0; i < this.documents.length; i++) {
  713. if (this.documents[i].doc === doc) {
  714. return i;
  715. }
  716. }
  717. return -1;
  718. }
  719. }, {
  720. key: "getDocOptions",
  721. value: function getDocOptions(doc) {
  722. var docIndex = this.getDocIndex(doc);
  723. return docIndex === -1 ? null : this.documents[docIndex].options;
  724. }
  725. }, {
  726. key: "now",
  727. value: function now() {
  728. return (this.window.Date || Date).now();
  729. }
  730. }]);
  731. return Scope;
  732. }();
  733. exports.Scope = Scope;
  734. function initScope(scope, window) {
  735. win.init(window);
  736. _domObjects["default"].init(window);
  737. browser.init(window);
  738. raf.init(window);
  739. events.init(window);
  740. scope.usePlugin(_interactions["default"]);
  741. scope.document = window.document;
  742. scope.window = window;
  743. return scope;
  744. }
  745. });
  746. var _$interactions_23 = createModuleFactory(function (module, exports) {
  747. "use strict";
  748. Object.defineProperty(exports, "__esModule", {
  749. value: true
  750. });
  751. exports["default"] = void 0;
  752. var _browser = _interopRequireDefault(_$browser_47);
  753. var _domObjects = _interopRequireDefault(_$domObjects_49);
  754. /* removed: var _$domUtils_50 = require("@interactjs/utils/domUtils"); */;
  755. var _events = _interopRequireDefault(_$events_51);
  756. var _pointerUtils = _interopRequireDefault(_$pointerUtils_60);
  757. var _Signals = _interopRequireDefault(_$Signals_45);
  758. var _Interaction = _interopRequireDefault(_$Interaction_18({}));
  759. var _interactionFinder = _interopRequireDefault(_$interactionFinder_22);
  760. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  761. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  762. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
  763. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  764. function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  765. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  766. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  767. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  768. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  769. function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  770. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  771. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  772. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  773. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  774. var methodNames = ['pointerDown', 'pointerMove', 'pointerUp', 'updatePointer', 'removePointer', 'windowBlur'];
  775. function install(scope) {
  776. var signals = new _Signals["default"]();
  777. var listeners = {};
  778. for (var _i = 0; _i < methodNames.length; _i++) {
  779. var method = methodNames[_i];
  780. listeners[method] = doOnInteractions(method, scope);
  781. }
  782. var pEventTypes = _browser["default"].pEventTypes;
  783. var eventMap;
  784. if (_domObjects["default"].PointerEvent) {
  785. eventMap = [{
  786. type: pEventTypes.down,
  787. listener: releasePointersOnRemovedEls
  788. }, {
  789. type: pEventTypes.down,
  790. listener: listeners.pointerDown
  791. }, {
  792. type: pEventTypes.move,
  793. listener: listeners.pointerMove
  794. }, {
  795. type: pEventTypes.up,
  796. listener: listeners.pointerUp
  797. }, {
  798. type: pEventTypes.cancel,
  799. listener: listeners.pointerUp
  800. }];
  801. } else {
  802. eventMap = [{
  803. type: 'mousedown',
  804. listener: listeners.pointerDown
  805. }, {
  806. type: 'mousemove',
  807. listener: listeners.pointerMove
  808. }, {
  809. type: 'mouseup',
  810. listener: listeners.pointerUp
  811. }, {
  812. type: 'touchstart',
  813. listener: releasePointersOnRemovedEls
  814. }, {
  815. type: 'touchstart',
  816. listener: listeners.pointerDown
  817. }, {
  818. type: 'touchmove',
  819. listener: listeners.pointerMove
  820. }, {
  821. type: 'touchend',
  822. listener: listeners.pointerUp
  823. }, {
  824. type: 'touchcancel',
  825. listener: listeners.pointerUp
  826. }];
  827. }
  828. eventMap.push({
  829. type: 'blur',
  830. listener: function listener(event) {
  831. for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) {
  832. var _ref;
  833. _ref = scope.interactions.list[_i2];
  834. var interaction = _ref;
  835. interaction.documentBlur(event);
  836. }
  837. }
  838. });
  839. scope.signals.on('add-document', onDocSignal);
  840. scope.signals.on('remove-document', onDocSignal); // for ignoring browser's simulated mouse events
  841. scope.prevTouchTime = 0;
  842. scope.Interaction =
  843. /*#__PURE__*/
  844. function (_InteractionBase) {
  845. _inherits(Interaction, _InteractionBase);
  846. function Interaction() {
  847. _classCallCheck(this, Interaction);
  848. return _possibleConstructorReturn(this, _getPrototypeOf(Interaction).apply(this, arguments));
  849. }
  850. _createClass(Interaction, [{
  851. key: "_now",
  852. value: function _now() {
  853. return scope.now();
  854. }
  855. }, {
  856. key: "pointerMoveTolerance",
  857. get: function get() {
  858. return scope.interactions.pointerMoveTolerance;
  859. },
  860. set: function set(value) {
  861. scope.interactions.pointerMoveTolerance = value;
  862. }
  863. }]);
  864. return Interaction;
  865. }(_Interaction["default"]);
  866. scope.interactions = {
  867. signals: signals,
  868. // all active and idle interactions
  869. list: [],
  870. "new": function _new(options) {
  871. options.signals = signals;
  872. var interaction = new scope.Interaction(options);
  873. scope.interactions.list.push(interaction);
  874. return interaction;
  875. },
  876. listeners: listeners,
  877. eventMap: eventMap,
  878. pointerMoveTolerance: 1
  879. };
  880. function releasePointersOnRemovedEls() {
  881. // for all inactive touch interactions with pointers down
  882. for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) {
  883. var _ref2;
  884. _ref2 = scope.interactions.list[_i3];
  885. var interaction = _ref2;
  886. if (!interaction.pointerIsDown || interaction.pointerType !== 'touch' || interaction._interacting) {
  887. continue;
  888. } // if a pointer is down on an element that is no longer in the DOM tree
  889. var _loop = function _loop() {
  890. _ref3 = interaction.pointers[_i4];
  891. var pointer = _ref3;
  892. if (!scope.documents.some(function (_ref4) {
  893. var doc = _ref4.doc;
  894. return (0, _$domUtils_50.nodeContains)(doc, pointer.downTarget);
  895. })) {
  896. // remove the pointer from the interaction
  897. interaction.removePointer(pointer.pointer, pointer.event);
  898. }
  899. };
  900. for (var _i4 = 0; _i4 < interaction.pointers.length; _i4++) {
  901. var _ref3;
  902. _loop();
  903. }
  904. }
  905. }
  906. }
  907. function doOnInteractions(method, scope) {
  908. return function (event) {
  909. var interactions = scope.interactions.list;
  910. var pointerType = _pointerUtils["default"].getPointerType(event);
  911. var _pointerUtils$getEven = _pointerUtils["default"].getEventTargets(event),
  912. _pointerUtils$getEven2 = _slicedToArray(_pointerUtils$getEven, 2),
  913. eventTarget = _pointerUtils$getEven2[0],
  914. curEventTarget = _pointerUtils$getEven2[1];
  915. var matches = []; // [ [pointer, interaction], ...]
  916. if (/^touch/.test(event.type)) {
  917. scope.prevTouchTime = scope.now();
  918. for (var _i5 = 0; _i5 < event.changedTouches.length; _i5++) {
  919. var _ref5;
  920. _ref5 = event.changedTouches[_i5];
  921. var changedTouch = _ref5;
  922. var pointer = changedTouch;
  923. var pointerId = _pointerUtils["default"].getPointerId(pointer);
  924. var searchDetails = {
  925. pointer: pointer,
  926. pointerId: pointerId,
  927. pointerType: pointerType,
  928. eventType: event.type,
  929. eventTarget: eventTarget,
  930. curEventTarget: curEventTarget,
  931. scope: scope
  932. };
  933. var interaction = getInteraction(searchDetails);
  934. matches.push([searchDetails.pointer, searchDetails.eventTarget, searchDetails.curEventTarget, interaction]);
  935. }
  936. } else {
  937. var invalidPointer = false;
  938. if (!_browser["default"].supportsPointerEvent && /mouse/.test(event.type)) {
  939. // ignore mouse events while touch interactions are active
  940. for (var i = 0; i < interactions.length && !invalidPointer; i++) {
  941. invalidPointer = interactions[i].pointerType !== 'mouse' && interactions[i].pointerIsDown;
  942. } // try to ignore mouse events that are simulated by the browser
  943. // after a touch event
  944. invalidPointer = invalidPointer || scope.now() - scope.prevTouchTime < 500 || // on iOS and Firefox Mobile, MouseEvent.timeStamp is zero if simulated
  945. event.timeStamp === 0;
  946. }
  947. if (!invalidPointer) {
  948. var _searchDetails = {
  949. pointer: event,
  950. pointerId: _pointerUtils["default"].getPointerId(event),
  951. pointerType: pointerType,
  952. eventType: event.type,
  953. curEventTarget: curEventTarget,
  954. eventTarget: eventTarget,
  955. scope: scope
  956. };
  957. var _interaction = getInteraction(_searchDetails);
  958. matches.push([_searchDetails.pointer, _searchDetails.eventTarget, _searchDetails.curEventTarget, _interaction]);
  959. }
  960. } // eslint-disable-next-line no-shadow
  961. for (var _i6 = 0; _i6 < matches.length; _i6++) {
  962. var _matches$_i = _slicedToArray(matches[_i6], 4),
  963. _pointer = _matches$_i[0],
  964. _eventTarget = _matches$_i[1],
  965. _curEventTarget = _matches$_i[2],
  966. _interaction2 = _matches$_i[3];
  967. _interaction2[method](_pointer, event, _eventTarget, _curEventTarget);
  968. }
  969. };
  970. }
  971. function getInteraction(searchDetails) {
  972. var pointerType = searchDetails.pointerType,
  973. scope = searchDetails.scope;
  974. var foundInteraction = _interactionFinder["default"].search(searchDetails);
  975. var signalArg = {
  976. interaction: foundInteraction,
  977. searchDetails: searchDetails
  978. };
  979. scope.interactions.signals.fire('find', signalArg);
  980. return signalArg.interaction || scope.interactions["new"]({
  981. pointerType: pointerType
  982. });
  983. }
  984. function onDocSignal(_ref6, signalName) {
  985. var doc = _ref6.doc,
  986. scope = _ref6.scope,
  987. options = _ref6.options;
  988. var eventMap = scope.interactions.eventMap;
  989. var eventMethod = signalName.indexOf('add') === 0 ? _events["default"].add : _events["default"].remove;
  990. if (scope.browser.isIOS && !options.events) {
  991. options.events = {
  992. passive: false
  993. };
  994. } // delegate event listener
  995. for (var eventType in _events["default"].delegatedEvents) {
  996. eventMethod(doc, eventType, _events["default"].delegateListener);
  997. eventMethod(doc, eventType, _events["default"].delegateUseCapture, true);
  998. }
  999. var eventOptions = options && options.events;
  1000. for (var _i7 = 0; _i7 < eventMap.length; _i7++) {
  1001. var _ref7;
  1002. _ref7 = eventMap[_i7];
  1003. var _ref8 = _ref7,
  1004. type = _ref8.type,
  1005. listener = _ref8.listener;
  1006. eventMethod(doc, type, listener, eventOptions);
  1007. }
  1008. }
  1009. var _default = {
  1010. id: 'core/interactions',
  1011. install: install,
  1012. onDocSignal: onDocSignal,
  1013. doOnInteractions: doOnInteractions,
  1014. methodNames: methodNames
  1015. };
  1016. exports["default"] = _default;
  1017. });
  1018. var _$Interaction_18 = createModuleFactory(function (module, exports) {
  1019. "use strict";
  1020. Object.defineProperty(exports, "__esModule", {
  1021. value: true
  1022. });
  1023. Object.defineProperty(exports, "PointerInfo", {
  1024. enumerable: true,
  1025. get: function get() {
  1026. return _PointerInfo["default"];
  1027. }
  1028. });
  1029. exports["default"] = exports.Interaction = exports._ProxyMethods = exports._ProxyValues = void 0;
  1030. var utils = _interopRequireWildcard(_$utils_55);
  1031. var _InteractEvent = _interopRequireWildcard(_$InteractEvent_15);
  1032. var _PointerInfo = _interopRequireDefault(_$PointerInfo_19);
  1033. var _scope = _$scope_24({});
  1034. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  1035. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  1036. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1037. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  1038. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  1039. var _ProxyValues;
  1040. exports._ProxyValues = _ProxyValues;
  1041. (function (_ProxyValues) {
  1042. _ProxyValues["interactable"] = "";
  1043. _ProxyValues["element"] = "";
  1044. _ProxyValues["prepared"] = "";
  1045. _ProxyValues["pointerIsDown"] = "";
  1046. _ProxyValues["pointerWasMoved"] = "";
  1047. _ProxyValues["_proxy"] = "";
  1048. })(_ProxyValues || (exports._ProxyValues = _ProxyValues = {}));
  1049. var _ProxyMethods;
  1050. exports._ProxyMethods = _ProxyMethods;
  1051. (function (_ProxyMethods) {
  1052. _ProxyMethods["start"] = "";
  1053. _ProxyMethods["move"] = "";
  1054. _ProxyMethods["end"] = "";
  1055. _ProxyMethods["stop"] = "";
  1056. _ProxyMethods["interacting"] = "";
  1057. })(_ProxyMethods || (exports._ProxyMethods = _ProxyMethods = {}));
  1058. var Interaction =
  1059. /*#__PURE__*/
  1060. function () {
  1061. /** */
  1062. function Interaction(_ref) {
  1063. var _this = this;
  1064. var pointerType = _ref.pointerType,
  1065. signals = _ref.signals;
  1066. _classCallCheck(this, Interaction);
  1067. // current interactable being interacted with
  1068. this.interactable = null; // the target element of the interactable
  1069. this.element = null; // action that's ready to be fired on next move event
  1070. this.prepared = {
  1071. name: null,
  1072. axis: null,
  1073. edges: null
  1074. }; // keep track of added pointers
  1075. this.pointers = []; // pointerdown/mousedown/touchstart event
  1076. this.downEvent = null;
  1077. this.downPointer = {};
  1078. this._latestPointer = {
  1079. pointer: null,
  1080. event: null,
  1081. eventTarget: null
  1082. }; // previous action event
  1083. this.prevEvent = null;
  1084. this.pointerIsDown = false;
  1085. this.pointerWasMoved = false;
  1086. this._interacting = false;
  1087. this._ending = false;
  1088. this._proxy = null;
  1089. this.simulation = null;
  1090. /**
  1091. * @alias Interaction.prototype.move
  1092. */
  1093. this.doMove = utils.warnOnce(function (signalArg) {
  1094. this.move(signalArg);
  1095. }, 'The interaction.doMove() method has been renamed to interaction.move()');
  1096. this.coords = {
  1097. // Starting InteractEvent pointer coordinates
  1098. start: utils.pointer.newCoords(),
  1099. // Previous native pointer move event coordinates
  1100. prev: utils.pointer.newCoords(),
  1101. // current native pointer move event coordinates
  1102. cur: utils.pointer.newCoords(),
  1103. // Change in coordinates and time of the pointer
  1104. delta: utils.pointer.newCoords(),
  1105. // pointer velocity
  1106. velocity: utils.pointer.newCoords()
  1107. };
  1108. this._signals = signals;
  1109. this.pointerType = pointerType;
  1110. var that = this;
  1111. this._proxy = {};
  1112. var _loop = function _loop(key) {
  1113. Object.defineProperty(_this._proxy, key, {
  1114. get: function get() {
  1115. return that[key];
  1116. }
  1117. });
  1118. };
  1119. for (var key in _ProxyValues) {
  1120. _loop(key);
  1121. }
  1122. var _loop2 = function _loop2(key) {
  1123. Object.defineProperty(_this._proxy, key, {
  1124. value: function value() {
  1125. return that[key].apply(that, arguments);
  1126. }
  1127. });
  1128. };
  1129. for (var key in _ProxyMethods) {
  1130. _loop2(key);
  1131. }
  1132. this._signals.fire('new', {
  1133. interaction: this
  1134. });
  1135. }
  1136. _createClass(Interaction, [{
  1137. key: "pointerDown",
  1138. value: function pointerDown(pointer, event, eventTarget) {
  1139. var pointerIndex = this.updatePointer(pointer, event, eventTarget, true);
  1140. this._signals.fire('down', {
  1141. pointer: pointer,
  1142. event: event,
  1143. eventTarget: eventTarget,
  1144. pointerIndex: pointerIndex,
  1145. interaction: this
  1146. });
  1147. }
  1148. /**
  1149. * ```js
  1150. * interact(target)
  1151. * .draggable({
  1152. * // disable the default drag start by down->move
  1153. * manualStart: true
  1154. * })
  1155. * // start dragging after the user holds the pointer down
  1156. * .on('hold', function (event) {
  1157. * var interaction = event.interaction
  1158. *
  1159. * if (!interaction.interacting()) {
  1160. * interaction.start({ name: 'drag' },
  1161. * event.interactable,
  1162. * event.currentTarget)
  1163. * }
  1164. * })
  1165. * ```
  1166. *
  1167. * Start an action with the given Interactable and Element as tartgets. The
  1168. * action must be enabled for the target Interactable and an appropriate
  1169. * number of pointers must be held down - 1 for drag/resize, 2 for gesture.
  1170. *
  1171. * Use it with `interactable.<action>able({ manualStart: false })` to always
  1172. * [start actions manually](https://github.com/taye/interact.js/issues/114)
  1173. *
  1174. * @param {object} action The action to be performed - drag, resize, etc.
  1175. * @param {Interactable} target The Interactable to target
  1176. * @param {Element} element The DOM Element to target
  1177. * @return {object} interact
  1178. */
  1179. }, {
  1180. key: "start",
  1181. value: function start(action, interactable, element) {
  1182. if (this.interacting() || !this.pointerIsDown || this.pointers.length < (action.name === _scope.ActionName.Gesture ? 2 : 1) || !interactable.options[action.name].enabled) {
  1183. return false;
  1184. }
  1185. utils.copyAction(this.prepared, action);
  1186. this.interactable = interactable;
  1187. this.element = element;
  1188. this.rect = interactable.getRect(element);
  1189. this.edges = this.prepared.edges;
  1190. this._interacting = this._doPhase({
  1191. interaction: this,
  1192. event: this.downEvent,
  1193. phase: _InteractEvent.EventPhase.Start
  1194. });
  1195. return this._interacting;
  1196. }
  1197. }, {
  1198. key: "pointerMove",
  1199. value: function pointerMove(pointer, event, eventTarget) {
  1200. if (!this.simulation && !(this.modifiers && this.modifiers.endPrevented)) {
  1201. this.updatePointer(pointer, event, eventTarget, false);
  1202. utils.pointer.setCoords(this.coords.cur, this.pointers.map(function (p) {
  1203. return p.pointer;
  1204. }), this._now());
  1205. }
  1206. var duplicateMove = this.coords.cur.page.x === this.coords.prev.page.x && this.coords.cur.page.y === this.coords.prev.page.y && this.coords.cur.client.x === this.coords.prev.client.x && this.coords.cur.client.y === this.coords.prev.client.y;
  1207. var dx;
  1208. var dy; // register movement greater than pointerMoveTolerance
  1209. if (this.pointerIsDown && !this.pointerWasMoved) {
  1210. dx = this.coords.cur.client.x - this.coords.start.client.x;
  1211. dy = this.coords.cur.client.y - this.coords.start.client.y;
  1212. this.pointerWasMoved = utils.hypot(dx, dy) > this.pointerMoveTolerance;
  1213. }
  1214. var signalArg = {
  1215. pointer: pointer,
  1216. pointerIndex: this.getPointerIndex(pointer),
  1217. event: event,
  1218. eventTarget: eventTarget,
  1219. dx: dx,
  1220. dy: dy,
  1221. duplicate: duplicateMove,
  1222. interaction: this
  1223. };
  1224. if (!duplicateMove) {
  1225. // set pointer coordinate, time changes and velocity
  1226. utils.pointer.setCoordDeltas(this.coords.delta, this.coords.prev, this.coords.cur);
  1227. utils.pointer.setCoordVelocity(this.coords.velocity, this.coords.delta);
  1228. }
  1229. this._signals.fire('move', signalArg);
  1230. if (!duplicateMove) {
  1231. // if interacting, fire an 'action-move' signal etc
  1232. if (this.interacting()) {
  1233. this.move(signalArg);
  1234. }
  1235. if (this.pointerWasMoved) {
  1236. utils.pointer.copyCoords(this.coords.prev, this.coords.cur);
  1237. }
  1238. }
  1239. }
  1240. /**
  1241. * ```js
  1242. * interact(target)
  1243. * .draggable(true)
  1244. * .on('dragmove', function (event) {
  1245. * if (someCondition) {
  1246. * // change the snap settings
  1247. * event.interactable.draggable({ snap: { targets: [] }})
  1248. * // fire another move event with re-calculated snap
  1249. * event.interaction.move()
  1250. * }
  1251. * })
  1252. * ```
  1253. *
  1254. * Force a move of the current action at the same coordinates. Useful if
  1255. * snap/restrict has been changed and you want a movement with the new
  1256. * settings.
  1257. */
  1258. }, {
  1259. key: "move",
  1260. value: function move(signalArg) {
  1261. signalArg = utils.extend({
  1262. pointer: this._latestPointer.pointer,
  1263. event: this._latestPointer.event,
  1264. eventTarget: this._latestPointer.eventTarget,
  1265. interaction: this
  1266. }, signalArg || {});
  1267. signalArg.phase = _InteractEvent.EventPhase.Move;
  1268. this._doPhase(signalArg);
  1269. } // End interact move events and stop auto-scroll unless simulation is running
  1270. }, {
  1271. key: "pointerUp",
  1272. value: function pointerUp(pointer, event, eventTarget, curEventTarget) {
  1273. var pointerIndex = this.getPointerIndex(pointer);
  1274. if (pointerIndex === -1) {
  1275. pointerIndex = this.updatePointer(pointer, event, eventTarget, false);
  1276. }
  1277. this._signals.fire(/cancel$/i.test(event.type) ? 'cancel' : 'up', {
  1278. pointer: pointer,
  1279. pointerIndex: pointerIndex,
  1280. event: event,
  1281. eventTarget: eventTarget,
  1282. curEventTarget: curEventTarget,
  1283. interaction: this
  1284. });
  1285. if (!this.simulation) {
  1286. this.end(event);
  1287. }
  1288. this.pointerIsDown = false;
  1289. this.removePointer(pointer, event);
  1290. }
  1291. }, {
  1292. key: "documentBlur",
  1293. value: function documentBlur(event) {
  1294. this.end(event);
  1295. this._signals.fire('blur', {
  1296. event: event,
  1297. interaction: this
  1298. });
  1299. }
  1300. /**
  1301. * ```js
  1302. * interact(target)
  1303. * .draggable(true)
  1304. * .on('move', function (event) {
  1305. * if (event.pageX > 1000) {
  1306. * // end the current action
  1307. * event.interaction.end()
  1308. * // stop all further listeners from being called
  1309. * event.stopImmediatePropagation()
  1310. * }
  1311. * })
  1312. * ```
  1313. *
  1314. * @param {PointerEvent} [event]
  1315. */
  1316. }, {
  1317. key: "end",
  1318. value: function end(event) {
  1319. this._ending = true;
  1320. event = event || this._latestPointer.event;
  1321. var endPhaseResult;
  1322. if (this.interacting()) {
  1323. endPhaseResult = this._doPhase({
  1324. event: event,
  1325. interaction: this,
  1326. phase: _InteractEvent.EventPhase.End
  1327. });
  1328. }
  1329. this._ending = false;
  1330. if (endPhaseResult === true) {
  1331. this.stop();
  1332. }
  1333. }
  1334. }, {
  1335. key: "currentAction",
  1336. value: function currentAction() {
  1337. return this._interacting ? this.prepared.name : null;
  1338. }
  1339. }, {
  1340. key: "interacting",
  1341. value: function interacting() {
  1342. return this._interacting;
  1343. }
  1344. /** */
  1345. }, {
  1346. key: "stop",
  1347. value: function stop() {
  1348. this._signals.fire('stop', {
  1349. interaction: this
  1350. });
  1351. this.interactable = this.element = null;
  1352. this._interacting = false;
  1353. this.prepared.name = this.prevEvent = null;
  1354. }
  1355. }, {
  1356. key: "getPointerIndex",
  1357. value: function getPointerIndex(pointer) {
  1358. var pointerId = utils.pointer.getPointerId(pointer); // mouse and pen interactions may have only one pointer
  1359. return this.pointerType === 'mouse' || this.pointerType === 'pen' ? this.pointers.length - 1 : utils.arr.findIndex(this.pointers, function (curPointer) {
  1360. return curPointer.id === pointerId;
  1361. });
  1362. }
  1363. }, {
  1364. key: "getPointerInfo",
  1365. value: function getPointerInfo(pointer) {
  1366. return this.pointers[this.getPointerIndex(pointer)];
  1367. }
  1368. }, {
  1369. key: "updatePointer",
  1370. value: function updatePointer(pointer, event, eventTarget, down) {
  1371. var id = utils.pointer.getPointerId(pointer);
  1372. var pointerIndex = this.getPointerIndex(pointer);
  1373. var pointerInfo = this.pointers[pointerIndex];
  1374. down = down === false ? false : down || /(down|start)$/i.test(event.type);
  1375. if (!pointerInfo) {
  1376. pointerInfo = new _PointerInfo["default"](id, pointer, event, null, null);
  1377. pointerIndex = this.pointers.length;
  1378. this.pointers.push(pointerInfo);
  1379. } else {
  1380. pointerInfo.pointer = pointer;
  1381. }
  1382. if (down) {
  1383. this.pointerIsDown = true;
  1384. if (!this.interacting()) {
  1385. utils.pointer.setCoords(this.coords.start, this.pointers.map(function (p) {
  1386. return p.pointer;
  1387. }), this._now());
  1388. utils.pointer.copyCoords(this.coords.cur, this.coords.start);
  1389. utils.pointer.copyCoords(this.coords.prev, this.coords.start);
  1390. utils.pointer.pointerExtend(this.downPointer, pointer);
  1391. this.downEvent = event;
  1392. pointerInfo.downTime = this.coords.cur.timeStamp;
  1393. pointerInfo.downTarget = eventTarget;
  1394. this.pointerWasMoved = false;
  1395. }
  1396. }
  1397. this._updateLatestPointer(pointer, event, eventTarget);
  1398. this._signals.fire('update-pointer', {
  1399. pointer: pointer,
  1400. event: event,
  1401. eventTarget: eventTarget,
  1402. down: down,
  1403. pointerInfo: pointerInfo,
  1404. pointerIndex: pointerIndex,
  1405. interaction: this
  1406. });
  1407. return pointerIndex;
  1408. }
  1409. }, {
  1410. key: "removePointer",
  1411. value: function removePointer(pointer, event) {
  1412. var pointerIndex = this.getPointerIndex(pointer);
  1413. if (pointerIndex === -1) {
  1414. return;
  1415. }
  1416. var pointerInfo = this.pointers[pointerIndex];
  1417. this._signals.fire('remove-pointer', {
  1418. pointer: pointer,
  1419. event: event,
  1420. pointerIndex: pointerIndex,
  1421. pointerInfo: pointerInfo,
  1422. interaction: this
  1423. });
  1424. this.pointers.splice(pointerIndex, 1);
  1425. }
  1426. }, {
  1427. key: "_updateLatestPointer",
  1428. value: function _updateLatestPointer(pointer, event, eventTarget) {
  1429. this._latestPointer.pointer = pointer;
  1430. this._latestPointer.event = event;
  1431. this._latestPointer.eventTarget = eventTarget;
  1432. }
  1433. }, {
  1434. key: "destroy",
  1435. value: function destroy() {
  1436. this._latestPointer.pointer = null;
  1437. this._latestPointer.event = null;
  1438. this._latestPointer.eventTarget = null;
  1439. }
  1440. }, {
  1441. key: "_createPreparedEvent",
  1442. value: function _createPreparedEvent(event, phase, preEnd, type) {
  1443. var actionName = this.prepared.name;
  1444. return new _InteractEvent["default"](this, event, actionName, phase, this.element, null, preEnd, type);
  1445. }
  1446. }, {
  1447. key: "_fireEvent",
  1448. value: function _fireEvent(iEvent) {
  1449. this.interactable.fire(iEvent);
  1450. if (!this.prevEvent || iEvent.timeStamp >= this.prevEvent.timeStamp) {
  1451. this.prevEvent = iEvent;
  1452. }
  1453. }
  1454. }, {
  1455. key: "_doPhase",
  1456. value: function _doPhase(signalArg) {
  1457. var event = signalArg.event,
  1458. phase = signalArg.phase,
  1459. preEnd = signalArg.preEnd,
  1460. type = signalArg.type;
  1461. var beforeResult = this._signals.fire("before-action-".concat(phase), signalArg);
  1462. if (beforeResult === false) {
  1463. return false;
  1464. }
  1465. var iEvent = signalArg.iEvent = this._createPreparedEvent(event, phase, preEnd, type);
  1466. var rect = this.rect;
  1467. if (rect) {
  1468. // update the rect modifications
  1469. var edges = this.edges || this.prepared.edges || {
  1470. left: true,
  1471. right: true,
  1472. top: true,
  1473. bottom: true
  1474. };
  1475. if (edges.top) {
  1476. rect.top += iEvent.delta.y;
  1477. }
  1478. if (edges.bottom) {
  1479. rect.bottom += iEvent.delta.y;
  1480. }
  1481. if (edges.left) {
  1482. rect.left += iEvent.delta.x;
  1483. }
  1484. if (edges.right) {
  1485. rect.right += iEvent.delta.x;
  1486. }
  1487. rect.width = rect.right - rect.left;
  1488. rect.height = rect.bottom - rect.top;
  1489. }
  1490. this._signals.fire("action-".concat(phase), signalArg);
  1491. this._fireEvent(iEvent);
  1492. this._signals.fire("after-action-".concat(phase), signalArg);
  1493. return true;
  1494. }
  1495. }, {
  1496. key: "_now",
  1497. value: function _now() {
  1498. return Date.now();
  1499. }
  1500. }, {
  1501. key: "pointerMoveTolerance",
  1502. get: function get() {
  1503. return 1;
  1504. }
  1505. }]);
  1506. return Interaction;
  1507. }();
  1508. exports.Interaction = Interaction;
  1509. var _default = Interaction;
  1510. exports["default"] = _default;
  1511. });
  1512. var _$arr_46 = {};
  1513. "use strict";
  1514. Object.defineProperty(_$arr_46, "__esModule", {
  1515. value: true
  1516. });
  1517. _$arr_46.contains = contains;
  1518. _$arr_46.remove = remove;
  1519. _$arr_46.merge = merge;
  1520. _$arr_46.from = from;
  1521. _$arr_46.findIndex = findIndex;
  1522. _$arr_46.find = find;
  1523. function contains(array, target) {
  1524. return array.indexOf(target) !== -1;
  1525. }
  1526. function remove(array, target) {
  1527. return array.splice(array.indexOf(target), 1);
  1528. }
  1529. function merge(target, source) {
  1530. for (var _i = 0; _i < source.length; _i++) {
  1531. var _ref;
  1532. _ref = source[_i];
  1533. var item = _ref;
  1534. target.push(item);
  1535. }
  1536. return target;
  1537. }
  1538. function from(source) {
  1539. return merge([], source);
  1540. }
  1541. function findIndex(array, func) {
  1542. for (var i = 0; i < array.length; i++) {
  1543. if (func(array[i], i, array)) {
  1544. return i;
  1545. }
  1546. }
  1547. return -1;
  1548. }
  1549. function find(array, func) {
  1550. return array[findIndex(array, func)];
  1551. }
  1552. var _$domObjects_49 = {};
  1553. "use strict";
  1554. Object.defineProperty(_$domObjects_49, "__esModule", {
  1555. value: true
  1556. });
  1557. _$domObjects_49["default"] = void 0;
  1558. var domObjects = {
  1559. init: init,
  1560. document: null,
  1561. DocumentFragment: null,
  1562. SVGElement: null,
  1563. SVGSVGElement: null,
  1564. // eslint-disable-next-line no-undef
  1565. SVGElementInstance: null,
  1566. Element: null,
  1567. HTMLElement: null,
  1568. Event: null,
  1569. Touch: null,
  1570. PointerEvent: null
  1571. };
  1572. function blank() {}
  1573. var _default = domObjects;
  1574. _$domObjects_49["default"] = _default;
  1575. function init(window) {
  1576. var win = window;
  1577. domObjects.document = win.document;
  1578. domObjects.DocumentFragment = win.DocumentFragment || blank;
  1579. domObjects.SVGElement = win.SVGElement || blank;
  1580. domObjects.SVGSVGElement = win.SVGSVGElement || blank;
  1581. domObjects.SVGElementInstance = win.SVGElementInstance || blank;
  1582. domObjects.Element = win.Element || blank;
  1583. domObjects.HTMLElement = win.HTMLElement || domObjects.Element;
  1584. domObjects.Event = win.Event;
  1585. domObjects.Touch = win.Touch || blank;
  1586. domObjects.PointerEvent = win.PointerEvent || win.MSPointerEvent;
  1587. }
  1588. var _$isWindow_57 = {};
  1589. "use strict";
  1590. Object.defineProperty(_$isWindow_57, "__esModule", {
  1591. value: true
  1592. });
  1593. _$isWindow_57["default"] = void 0;
  1594. var ___default_57 = function _default(thing) {
  1595. return !!(thing && thing.Window) && thing instanceof thing.Window;
  1596. };
  1597. _$isWindow_57["default"] = ___default_57;
  1598. var _$window_65 = {};
  1599. "use strict";
  1600. Object.defineProperty(_$window_65, "__esModule", {
  1601. value: true
  1602. });
  1603. _$window_65.init = __init_65;
  1604. _$window_65.getWindow = getWindow;
  1605. _$window_65["default"] = void 0;
  1606. var _isWindow = _interopRequireDefault(_$isWindow_57);
  1607. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  1608. var win = {
  1609. realWindow: undefined,
  1610. window: undefined,
  1611. getWindow: getWindow,
  1612. init: __init_65
  1613. };
  1614. function __init_65(window) {
  1615. // get wrapped window if using Shadow DOM polyfill
  1616. win.realWindow = window; // create a TextNode
  1617. var el = window.document.createTextNode(''); // check if it's wrapped by a polyfill
  1618. if (el.ownerDocument !== window.document && typeof window.wrap === 'function' && window.wrap(el) === el) {
  1619. // use wrapped window
  1620. window = window.wrap(window);
  1621. }
  1622. win.window = window;
  1623. }
  1624. if (typeof window === 'undefined') {
  1625. win.window = undefined;
  1626. win.realWindow = undefined;
  1627. } else {
  1628. __init_65(window);
  1629. }
  1630. function getWindow(node) {
  1631. if ((0, _isWindow["default"])(node)) {
  1632. return node;
  1633. }
  1634. var rootNode = node.ownerDocument || node;
  1635. return rootNode.defaultView || win.window;
  1636. }
  1637. win.init = __init_65;
  1638. var ___default_65 = win;
  1639. _$window_65["default"] = ___default_65;
  1640. var _$is_56 = {};
  1641. "use strict";
  1642. Object.defineProperty(_$is_56, "__esModule", {
  1643. value: true
  1644. });
  1645. _$is_56.array = _$is_56.plainObject = _$is_56.element = _$is_56.string = _$is_56.bool = _$is_56.number = _$is_56.func = _$is_56.object = _$is_56.docFrag = _$is_56.window = void 0;
  1646. var ___isWindow_56 = ___interopRequireDefault_56(_$isWindow_57);
  1647. var _window2 = ___interopRequireDefault_56(_$window_65);
  1648. function ___interopRequireDefault_56(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  1649. function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
  1650. var __window_56 = function window(thing) {
  1651. return thing === _window2["default"].window || (0, ___isWindow_56["default"])(thing);
  1652. };
  1653. _$is_56.window = __window_56;
  1654. var docFrag = function docFrag(thing) {
  1655. return object(thing) && thing.nodeType === 11;
  1656. };
  1657. _$is_56.docFrag = docFrag;
  1658. var object = function object(thing) {
  1659. return !!thing && _typeof(thing) === 'object';
  1660. };
  1661. _$is_56.object = object;
  1662. var func = function func(thing) {
  1663. return typeof thing === 'function';
  1664. };
  1665. _$is_56.func = func;
  1666. var number = function number(thing) {
  1667. return typeof thing === 'number';
  1668. };
  1669. _$is_56.number = number;
  1670. var bool = function bool(thing) {
  1671. return typeof thing === 'boolean';
  1672. };
  1673. _$is_56.bool = bool;
  1674. var string = function string(thing) {
  1675. return typeof thing === 'string';
  1676. };
  1677. _$is_56.string = string;
  1678. var element = function element(thing) {
  1679. if (!thing || _typeof(thing) !== 'object') {
  1680. return false;
  1681. }
  1682. var _window = _window2["default"].getWindow(thing) || _window2["default"].window;
  1683. return /object|function/.test(_typeof(_window.Element)) ? thing instanceof _window.Element // DOM2
  1684. : thing.nodeType === 1 && typeof thing.nodeName === 'string';
  1685. };
  1686. _$is_56.element = element;
  1687. var plainObject = function plainObject(thing) {
  1688. return object(thing) && !!thing.constructor && /function Object\b/.test(thing.constructor.toString());
  1689. };
  1690. _$is_56.plainObject = plainObject;
  1691. var array = function array(thing) {
  1692. return object(thing) && typeof thing.length !== 'undefined' && func(thing.splice);
  1693. };
  1694. _$is_56.array = array;
  1695. var _$browser_47 = {};
  1696. "use strict";
  1697. Object.defineProperty(_$browser_47, "__esModule", {
  1698. value: true
  1699. });
  1700. _$browser_47["default"] = void 0;
  1701. var _domObjects = ___interopRequireDefault_47(_$domObjects_49);
  1702. var is = _interopRequireWildcard(_$is_56);
  1703. var _window = ___interopRequireDefault_47(_$window_65);
  1704. function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  1705. function ___interopRequireDefault_47(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  1706. var browser = {
  1707. init: __init_47,
  1708. supportsTouch: null,
  1709. supportsPointerEvent: null,
  1710. isIOS7: null,
  1711. isIOS: null,
  1712. isIe9: null,
  1713. isOperaMobile: null,
  1714. prefixedMatchesSelector: null,
  1715. pEventTypes: null,
  1716. wheelEvent: null
  1717. };
  1718. function __init_47(window) {
  1719. var Element = _domObjects["default"].Element;
  1720. var navigator = _window["default"].window.navigator; // Does the browser support touch input?
  1721. browser.supportsTouch = 'ontouchstart' in window || is.func(window.DocumentTouch) && _domObjects["default"].document instanceof window.DocumentTouch; // Does the browser support PointerEvents
  1722. browser.supportsPointerEvent = navigator.pointerEnabled !== false && !!_domObjects["default"].PointerEvent;
  1723. browser.isIOS = /iP(hone|od|ad)/.test(navigator.platform); // scrolling doesn't change the result of getClientRects on iOS 7
  1724. browser.isIOS7 = /iP(hone|od|ad)/.test(navigator.platform) && /OS 7[^\d]/.test(navigator.appVersion);
  1725. browser.isIe9 = /MSIE 9/.test(navigator.userAgent); // Opera Mobile must be handled differently
  1726. browser.isOperaMobile = navigator.appName === 'Opera' && browser.supportsTouch && /Presto/.test(navigator.userAgent); // prefix matchesSelector
  1727. browser.prefixedMatchesSelector = 'matches' in Element.prototype ? 'matches' : 'webkitMatchesSelector' in Element.prototype ? 'webkitMatchesSelector' : 'mozMatchesSelector' in Element.prototype ? 'mozMatchesSelector' : 'oMatchesSelector' in Element.prototype ? 'oMatchesSelector' : 'msMatchesSelector';
  1728. browser.pEventTypes = browser.supportsPointerEvent ? _domObjects["default"].PointerEvent === window.MSPointerEvent ? {
  1729. up: 'MSPointerUp',
  1730. down: 'MSPointerDown',
  1731. over: 'mouseover',
  1732. out: 'mouseout',
  1733. move: 'MSPointerMove',
  1734. cancel: 'MSPointerCancel'
  1735. } : {
  1736. up: 'pointerup',
  1737. down: 'pointerdown',
  1738. over: 'pointerover',
  1739. out: 'pointerout',
  1740. move: 'pointermove',
  1741. cancel: 'pointercancel'
  1742. } : null; // because Webkit and Opera still use 'mousewheel' event type
  1743. browser.wheelEvent = 'onmousewheel' in _domObjects["default"].document ? 'mousewheel' : 'wheel';
  1744. }
  1745. var ___default_47 = browser;
  1746. _$browser_47["default"] = ___default_47;
  1747. var _$domUtils_50 = {};
  1748. "use strict";
  1749. Object.defineProperty(_$domUtils_50, "__esModule", {
  1750. value: true
  1751. });
  1752. _$domUtils_50.nodeContains = nodeContains;
  1753. _$domUtils_50.closest = closest;
  1754. _$domUtils_50.parentNode = parentNode;
  1755. _$domUtils_50.matchesSelector = matchesSelector;
  1756. _$domUtils_50.indexOfDeepestElement = indexOfDeepestElement;
  1757. _$domUtils_50.matchesUpTo = matchesUpTo;
  1758. _$domUtils_50.getActualElement = getActualElement;
  1759. _$domUtils_50.getScrollXY = getScrollXY;
  1760. _$domUtils_50.getElementClientRect = getElementClientRect;
  1761. _$domUtils_50.getElementRect = getElementRect;
  1762. _$domUtils_50.getPath = getPath;
  1763. _$domUtils_50.trySelector = trySelector;
  1764. var _browser = ___interopRequireDefault_50(_$browser_47);
  1765. var ___domObjects_50 = ___interopRequireDefault_50(_$domObjects_49);
  1766. var __is_50 = ___interopRequireWildcard_50(_$is_56);
  1767. var ___window_50 = ___interopRequireDefault_50(_$window_65);
  1768. function ___interopRequireWildcard_50(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  1769. function ___interopRequireDefault_50(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  1770. function nodeContains(parent, child) {
  1771. while (child) {
  1772. if (child === parent) {
  1773. return true;
  1774. }
  1775. child = child.parentNode;
  1776. }
  1777. return false;
  1778. }
  1779. function closest(element, selector) {
  1780. while (__is_50.element(element)) {
  1781. if (matchesSelector(element, selector)) {
  1782. return element;
  1783. }
  1784. element = parentNode(element);
  1785. }
  1786. return null;
  1787. }
  1788. function parentNode(node) {
  1789. var parent = node.parentNode;
  1790. if (__is_50.docFrag(parent)) {
  1791. // skip past #shado-root fragments
  1792. // tslint:disable-next-line
  1793. while ((parent = parent.host) && __is_50.docFrag(parent)) {
  1794. continue;
  1795. }
  1796. return parent;
  1797. }
  1798. return parent;
  1799. }
  1800. function matchesSelector(element, selector) {
  1801. // remove /deep/ from selectors if shadowDOM polyfill is used
  1802. if (___window_50["default"].window !== ___window_50["default"].realWindow) {
  1803. selector = selector.replace(/\/deep\//g, ' ');
  1804. }
  1805. return element[_browser["default"].prefixedMatchesSelector](selector);
  1806. }
  1807. var getParent = function getParent(el) {
  1808. return el.parentNode ? el.parentNode : el.host;
  1809. }; // Test for the element that's "above" all other qualifiers
  1810. function indexOfDeepestElement(elements) {
  1811. var deepestZoneParents = [];
  1812. var dropzoneParents = [];
  1813. var dropzone;
  1814. var deepestZone = elements[0];
  1815. var index = deepestZone ? 0 : -1;
  1816. var parent;
  1817. var child;
  1818. var i;
  1819. var n;
  1820. for (i = 1; i < elements.length; i++) {
  1821. dropzone = elements[i]; // an element might belong to multiple selector dropzones
  1822. if (!dropzone || dropzone === deepestZone) {
  1823. continue;
  1824. }
  1825. if (!deepestZone) {
  1826. deepestZone = dropzone;
  1827. index = i;
  1828. continue;
  1829. } // check if the deepest or current are document.documentElement or document.rootElement
  1830. // - if the current dropzone is, do nothing and continue
  1831. if (dropzone.parentNode === dropzone.ownerDocument) {
  1832. continue;
  1833. } // - if deepest is, update with the current dropzone and continue to next
  1834. else if (deepestZone.parentNode === dropzone.ownerDocument) {
  1835. deepestZone = dropzone;
  1836. index = i;
  1837. continue;
  1838. }
  1839. if (!deepestZoneParents.length) {
  1840. parent = deepestZone;
  1841. while (getParent(parent) && getParent(parent) !== parent.ownerDocument) {
  1842. deepestZoneParents.unshift(parent);
  1843. parent = getParent(parent);
  1844. }
  1845. } // if this element is an svg element and the current deepest is
  1846. // an HTMLElement
  1847. if (deepestZone instanceof ___domObjects_50["default"].HTMLElement && dropzone instanceof ___domObjects_50["default"].SVGElement && !(dropzone instanceof ___domObjects_50["default"].SVGSVGElement)) {
  1848. if (dropzone === deepestZone.parentNode) {
  1849. continue;
  1850. }
  1851. parent = dropzone.ownerSVGElement;
  1852. } else {
  1853. parent = dropzone;
  1854. }
  1855. dropzoneParents = [];
  1856. while (parent.parentNode !== parent.ownerDocument) {
  1857. dropzoneParents.unshift(parent);
  1858. parent = getParent(parent);
  1859. }
  1860. n = 0; // get (position of last common ancestor) + 1
  1861. while (dropzoneParents[n] && dropzoneParents[n] === deepestZoneParents[n]) {
  1862. n++;
  1863. }
  1864. var parents = [dropzoneParents[n - 1], dropzoneParents[n], deepestZoneParents[n]];
  1865. child = parents[0].lastChild;
  1866. while (child) {
  1867. if (child === parents[1]) {
  1868. deepestZone = dropzone;
  1869. index = i;
  1870. deepestZoneParents = [];
  1871. break;
  1872. } else if (child === parents[2]) {
  1873. break;
  1874. }
  1875. child = child.previousSibling;
  1876. }
  1877. }
  1878. return index;
  1879. }
  1880. function matchesUpTo(element, selector, limit) {
  1881. while (__is_50.element(element)) {
  1882. if (matchesSelector(element, selector)) {
  1883. return true;
  1884. }
  1885. element = parentNode(element);
  1886. if (element === limit) {
  1887. return matchesSelector(element, selector);
  1888. }
  1889. }
  1890. return false;
  1891. }
  1892. function getActualElement(element) {
  1893. return element instanceof ___domObjects_50["default"].SVGElementInstance ? element.correspondingUseElement : element;
  1894. }
  1895. function getScrollXY(relevantWindow) {
  1896. relevantWindow = relevantWindow || ___window_50["default"].window;
  1897. return {
  1898. x: relevantWindow.scrollX || relevantWindow.document.documentElement.scrollLeft,
  1899. y: relevantWindow.scrollY || relevantWindow.document.documentElement.scrollTop
  1900. };
  1901. }
  1902. function getElementClientRect(element) {
  1903. var clientRect = element instanceof ___domObjects_50["default"].SVGElement ? element.getBoundingClientRect() : element.getClientRects()[0];
  1904. return clientRect && {
  1905. left: clientRect.left,
  1906. right: clientRect.right,
  1907. top: clientRect.top,
  1908. bottom: clientRect.bottom,
  1909. width: clientRect.width || clientRect.right - clientRect.left,
  1910. height: clientRect.height || clientRect.bottom - clientRect.top
  1911. };
  1912. }
  1913. function getElementRect(element) {
  1914. var clientRect = getElementClientRect(element);
  1915. if (!_browser["default"].isIOS7 && clientRect) {
  1916. var scroll = getScrollXY(___window_50["default"].getWindow(element));
  1917. clientRect.left += scroll.x;
  1918. clientRect.right += scroll.x;
  1919. clientRect.top += scroll.y;
  1920. clientRect.bottom += scroll.y;
  1921. }
  1922. return clientRect;
  1923. }
  1924. function getPath(node) {
  1925. var path = [];
  1926. while (node) {
  1927. path.push(node);
  1928. node = parentNode(node);
  1929. }
  1930. return path;
  1931. }
  1932. function trySelector(value) {
  1933. if (!__is_50.string(value)) {
  1934. return false;
  1935. } // an exception will be raised if it is invalid
  1936. ___domObjects_50["default"].document.querySelector(value);
  1937. return true;
  1938. }
  1939. var _$clone_48 = {};
  1940. "use strict";
  1941. Object.defineProperty(_$clone_48, "__esModule", {
  1942. value: true
  1943. });
  1944. _$clone_48["default"] = clone;
  1945. var arr = ___interopRequireWildcard_48(_$arr_46);
  1946. var __is_48 = ___interopRequireWildcard_48(_$is_56);
  1947. function ___interopRequireWildcard_48(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  1948. function clone(source) {
  1949. var dest = {};
  1950. for (var prop in source) {
  1951. var value = source[prop];
  1952. if (__is_48.plainObject(value)) {
  1953. dest[prop] = clone(value);
  1954. } else if (__is_48.array(value)) {
  1955. dest[prop] = arr.from(value);
  1956. } else {
  1957. dest[prop] = value;
  1958. }
  1959. }
  1960. return dest;
  1961. }
  1962. var _$pointerExtend_59 = {};
  1963. "use strict";
  1964. Object.defineProperty(_$pointerExtend_59, "__esModule", {
  1965. value: true
  1966. });
  1967. _$pointerExtend_59["default"] = void 0;
  1968. function pointerExtend(dest, source) {
  1969. for (var prop in source) {
  1970. var prefixedPropREs = pointerExtend.prefixedPropREs;
  1971. var deprecated = false; // skip deprecated prefixed properties
  1972. for (var vendor in prefixedPropREs) {
  1973. if (prop.indexOf(vendor) === 0 && prefixedPropREs[vendor].test(prop)) {
  1974. deprecated = true;
  1975. break;
  1976. }
  1977. }
  1978. if (!deprecated && typeof source[prop] !== 'function') {
  1979. dest[prop] = source[prop];
  1980. }
  1981. }
  1982. return dest;
  1983. }
  1984. pointerExtend.prefixedPropREs = {
  1985. webkit: /(Movement[XY]|Radius[XY]|RotationAngle|Force)$/
  1986. };
  1987. var ___default_59 = pointerExtend;
  1988. _$pointerExtend_59["default"] = ___default_59;
  1989. var _$hypot_54 = {};
  1990. "use strict";
  1991. Object.defineProperty(_$hypot_54, "__esModule", {
  1992. value: true
  1993. });
  1994. _$hypot_54["default"] = void 0;
  1995. var ___default_54 = function _default(x, y) {
  1996. return Math.sqrt(x * x + y * y);
  1997. };
  1998. _$hypot_54["default"] = ___default_54;
  1999. var _$pointerUtils_60 = {};
  2000. "use strict";
  2001. Object.defineProperty(_$pointerUtils_60, "__esModule", {
  2002. value: true
  2003. });
  2004. _$pointerUtils_60["default"] = void 0;
  2005. var ___browser_60 = ___interopRequireDefault_60(_$browser_47);
  2006. var ___domObjects_60 = ___interopRequireDefault_60(_$domObjects_49);
  2007. var domUtils = ___interopRequireWildcard_60(_$domUtils_50);
  2008. var _hypot = ___interopRequireDefault_60(_$hypot_54);
  2009. var __is_60 = ___interopRequireWildcard_60(_$is_56);
  2010. var _pointerExtend = ___interopRequireDefault_60(_$pointerExtend_59);
  2011. function ___interopRequireWildcard_60(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2012. function ___interopRequireDefault_60(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2013. var pointerUtils = {
  2014. copyCoords: function copyCoords(dest, src) {
  2015. dest.page = dest.page || {};
  2016. dest.page.x = src.page.x;
  2017. dest.page.y = src.page.y;
  2018. dest.client = dest.client || {};
  2019. dest.client.x = src.client.x;
  2020. dest.client.y = src.client.y;
  2021. dest.timeStamp = src.timeStamp;
  2022. },
  2023. setCoordDeltas: function setCoordDeltas(targetObj, prev, cur) {
  2024. targetObj.page.x = cur.page.x - prev.page.x;
  2025. targetObj.page.y = cur.page.y - prev.page.y;
  2026. targetObj.client.x = cur.client.x - prev.client.x;
  2027. targetObj.client.y = cur.client.y - prev.client.y;
  2028. targetObj.timeStamp = cur.timeStamp - prev.timeStamp;
  2029. },
  2030. setCoordVelocity: function setCoordVelocity(targetObj, delta) {
  2031. var dt = Math.max(delta.timeStamp / 1000, 0.001);
  2032. targetObj.page.x = delta.page.x / dt;
  2033. targetObj.page.y = delta.page.y / dt;
  2034. targetObj.client.x = delta.client.x / dt;
  2035. targetObj.client.y = delta.client.y / dt;
  2036. targetObj.timeStamp = dt;
  2037. },
  2038. isNativePointer: function isNativePointer(pointer) {
  2039. return pointer instanceof ___domObjects_60["default"].Event || pointer instanceof ___domObjects_60["default"].Touch;
  2040. },
  2041. // Get specified X/Y coords for mouse or event.touches[0]
  2042. getXY: function getXY(type, pointer, xy) {
  2043. xy = xy || {};
  2044. type = type || 'page';
  2045. xy.x = pointer[type + 'X'];
  2046. xy.y = pointer[type + 'Y'];
  2047. return xy;
  2048. },
  2049. getPageXY: function getPageXY(pointer, page) {
  2050. page = page || {
  2051. x: 0,
  2052. y: 0
  2053. }; // Opera Mobile handles the viewport and scrolling oddly
  2054. if (___browser_60["default"].isOperaMobile && pointerUtils.isNativePointer(pointer)) {
  2055. pointerUtils.getXY('screen', pointer, page);
  2056. page.x += window.scrollX;
  2057. page.y += window.scrollY;
  2058. } else {
  2059. pointerUtils.getXY('page', pointer, page);
  2060. }
  2061. return page;
  2062. },
  2063. getClientXY: function getClientXY(pointer, client) {
  2064. client = client || {};
  2065. if (___browser_60["default"].isOperaMobile && pointerUtils.isNativePointer(pointer)) {
  2066. // Opera Mobile handles the viewport and scrolling oddly
  2067. pointerUtils.getXY('screen', pointer, client);
  2068. } else {
  2069. pointerUtils.getXY('client', pointer, client);
  2070. }
  2071. return client;
  2072. },
  2073. getPointerId: function getPointerId(pointer) {
  2074. return __is_60.number(pointer.pointerId) ? pointer.pointerId : pointer.identifier;
  2075. },
  2076. setCoords: function setCoords(targetObj, pointers, timeStamp) {
  2077. var pointer = pointers.length > 1 ? pointerUtils.pointerAverage(pointers) : pointers[0];
  2078. var tmpXY = {};
  2079. pointerUtils.getPageXY(pointer, tmpXY);
  2080. targetObj.page.x = tmpXY.x;
  2081. targetObj.page.y = tmpXY.y;
  2082. pointerUtils.getClientXY(pointer, tmpXY);
  2083. targetObj.client.x = tmpXY.x;
  2084. targetObj.client.y = tmpXY.y;
  2085. targetObj.timeStamp = timeStamp;
  2086. },
  2087. pointerExtend: _pointerExtend["default"],
  2088. getTouchPair: function getTouchPair(event) {
  2089. var touches = []; // array of touches is supplied
  2090. if (__is_60.array(event)) {
  2091. touches[0] = event[0];
  2092. touches[1] = event[1];
  2093. } // an event
  2094. else {
  2095. if (event.type === 'touchend') {
  2096. if (event.touches.length === 1) {
  2097. touches[0] = event.touches[0];
  2098. touches[1] = event.changedTouches[0];
  2099. } else if (event.touches.length === 0) {
  2100. touches[0] = event.changedTouches[0];
  2101. touches[1] = event.changedTouches[1];
  2102. }
  2103. } else {
  2104. touches[0] = event.touches[0];
  2105. touches[1] = event.touches[1];
  2106. }
  2107. }
  2108. return touches;
  2109. },
  2110. pointerAverage: function pointerAverage(pointers) {
  2111. var average = {
  2112. pageX: 0,
  2113. pageY: 0,
  2114. clientX: 0,
  2115. clientY: 0,
  2116. screenX: 0,
  2117. screenY: 0
  2118. };
  2119. for (var _i = 0; _i < pointers.length; _i++) {
  2120. var _ref;
  2121. _ref = pointers[_i];
  2122. var pointer = _ref;
  2123. for (var _prop in average) {
  2124. average[_prop] += pointer[_prop];
  2125. }
  2126. }
  2127. for (var prop in average) {
  2128. average[prop] /= pointers.length;
  2129. }
  2130. return average;
  2131. },
  2132. touchBBox: function touchBBox(event) {
  2133. if (!event.length && !(event.touches && event.touches.length > 1)) {
  2134. return null;
  2135. }
  2136. var touches = pointerUtils.getTouchPair(event);
  2137. var minX = Math.min(touches[0].pageX, touches[1].pageX);
  2138. var minY = Math.min(touches[0].pageY, touches[1].pageY);
  2139. var maxX = Math.max(touches[0].pageX, touches[1].pageX);
  2140. var maxY = Math.max(touches[0].pageY, touches[1].pageY);
  2141. return {
  2142. x: minX,
  2143. y: minY,
  2144. left: minX,
  2145. top: minY,
  2146. right: maxX,
  2147. bottom: maxY,
  2148. width: maxX - minX,
  2149. height: maxY - minY
  2150. };
  2151. },
  2152. touchDistance: function touchDistance(event, deltaSource) {
  2153. var sourceX = deltaSource + 'X';
  2154. var sourceY = deltaSource + 'Y';
  2155. var touches = pointerUtils.getTouchPair(event);
  2156. var dx = touches[0][sourceX] - touches[1][sourceX];
  2157. var dy = touches[0][sourceY] - touches[1][sourceY];
  2158. return (0, _hypot["default"])(dx, dy);
  2159. },
  2160. touchAngle: function touchAngle(event, deltaSource) {
  2161. var sourceX = deltaSource + 'X';
  2162. var sourceY = deltaSource + 'Y';
  2163. var touches = pointerUtils.getTouchPair(event);
  2164. var dx = touches[1][sourceX] - touches[0][sourceX];
  2165. var dy = touches[1][sourceY] - touches[0][sourceY];
  2166. var angle = 180 * Math.atan2(dy, dx) / Math.PI;
  2167. return angle;
  2168. },
  2169. getPointerType: function getPointerType(pointer) {
  2170. return __is_60.string(pointer.pointerType) ? pointer.pointerType : __is_60.number(pointer.pointerType) ? [undefined, undefined, 'touch', 'pen', 'mouse'][pointer.pointerType] // if the PointerEvent API isn't available, then the "pointer" must
  2171. // be either a MouseEvent, TouchEvent, or Touch object
  2172. : /touch/.test(pointer.type) || pointer instanceof ___domObjects_60["default"].Touch ? 'touch' : 'mouse';
  2173. },
  2174. // [ event.target, event.currentTarget ]
  2175. getEventTargets: function getEventTargets(event) {
  2176. var path = __is_60.func(event.composedPath) ? event.composedPath() : event.path;
  2177. return [domUtils.getActualElement(path ? path[0] : event.target), domUtils.getActualElement(event.currentTarget)];
  2178. },
  2179. newCoords: function newCoords() {
  2180. return {
  2181. page: {
  2182. x: 0,
  2183. y: 0
  2184. },
  2185. client: {
  2186. x: 0,
  2187. y: 0
  2188. },
  2189. timeStamp: 0
  2190. };
  2191. },
  2192. coordsToEvent: function coordsToEvent(coords) {
  2193. var event = {
  2194. coords: coords,
  2195. get page() {
  2196. return this.coords.page;
  2197. },
  2198. get client() {
  2199. return this.coords.client;
  2200. },
  2201. get timeStamp() {
  2202. return this.coords.timeStamp;
  2203. },
  2204. get pageX() {
  2205. return this.coords.page.x;
  2206. },
  2207. get pageY() {
  2208. return this.coords.page.y;
  2209. },
  2210. get clientX() {
  2211. return this.coords.client.x;
  2212. },
  2213. get clientY() {
  2214. return this.coords.client.y;
  2215. },
  2216. get pointerId() {
  2217. return this.coords.pointerId;
  2218. },
  2219. get target() {
  2220. return this.coords.target;
  2221. },
  2222. get type() {
  2223. return this.coords.type;
  2224. },
  2225. get pointerType() {
  2226. return this.coords.pointerType;
  2227. }
  2228. };
  2229. return event;
  2230. }
  2231. };
  2232. var ___default_60 = pointerUtils;
  2233. _$pointerUtils_60["default"] = ___default_60;
  2234. var _$events_51 = {};
  2235. "use strict";
  2236. Object.defineProperty(_$events_51, "__esModule", {
  2237. value: true
  2238. });
  2239. _$events_51["default"] = _$events_51.FakeEvent = void 0;
  2240. /* removed: var _$arr_46 = require("./arr"); */;
  2241. var __domUtils_51 = ___interopRequireWildcard_51(_$domUtils_50);
  2242. var __is_51 = ___interopRequireWildcard_51(_$is_56);
  2243. var ___pointerExtend_51 = ___interopRequireDefault_51(_$pointerExtend_59);
  2244. var _pointerUtils = ___interopRequireDefault_51(_$pointerUtils_60);
  2245. function ___interopRequireDefault_51(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2246. function ___interopRequireWildcard_51(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2247. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2248. function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2249. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  2250. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
  2251. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  2252. function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  2253. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  2254. var elements = [];
  2255. var targets = [];
  2256. var delegatedEvents = {};
  2257. var documents = [];
  2258. function add(element, type, listener, optionalArg) {
  2259. var options = getOptions(optionalArg);
  2260. var elementIndex = elements.indexOf(element);
  2261. var target = targets[elementIndex];
  2262. if (!target) {
  2263. target = {
  2264. events: {},
  2265. typeCount: 0
  2266. };
  2267. elementIndex = elements.push(element) - 1;
  2268. targets.push(target);
  2269. }
  2270. if (!target.events[type]) {
  2271. target.events[type] = [];
  2272. target.typeCount++;
  2273. }
  2274. if (!(0, _$arr_46.contains)(target.events[type], listener)) {
  2275. element.addEventListener(type, listener, events.supportsOptions ? options : !!options.capture);
  2276. target.events[type].push(listener);
  2277. }
  2278. }
  2279. function __remove_51(element, type, listener, optionalArg) {
  2280. var options = getOptions(optionalArg);
  2281. var elementIndex = elements.indexOf(element);
  2282. var target = targets[elementIndex];
  2283. if (!target || !target.events) {
  2284. return;
  2285. }
  2286. if (type === 'all') {
  2287. for (type in target.events) {
  2288. if (target.events.hasOwnProperty(type)) {
  2289. __remove_51(element, type, 'all');
  2290. }
  2291. }
  2292. return;
  2293. }
  2294. if (target.events[type]) {
  2295. var len = target.events[type].length;
  2296. if (listener === 'all') {
  2297. for (var i = 0; i < len; i++) {
  2298. __remove_51(element, type, target.events[type][i], options);
  2299. }
  2300. return;
  2301. } else {
  2302. for (var _i = 0; _i < len; _i++) {
  2303. if (target.events[type][_i] === listener) {
  2304. element.removeEventListener(type, listener, events.supportsOptions ? options : !!options.capture);
  2305. target.events[type].splice(_i, 1);
  2306. break;
  2307. }
  2308. }
  2309. }
  2310. if (target.events[type] && target.events[type].length === 0) {
  2311. target.events[type] = null;
  2312. target.typeCount--;
  2313. }
  2314. }
  2315. if (!target.typeCount) {
  2316. targets.splice(elementIndex, 1);
  2317. elements.splice(elementIndex, 1);
  2318. }
  2319. }
  2320. function addDelegate(selector, context, type, listener, optionalArg) {
  2321. var options = getOptions(optionalArg);
  2322. if (!delegatedEvents[type]) {
  2323. delegatedEvents[type] = {
  2324. contexts: [],
  2325. listeners: [],
  2326. selectors: []
  2327. }; // add delegate listener functions
  2328. for (var _i2 = 0; _i2 < documents.length; _i2++) {
  2329. var doc = documents[_i2];
  2330. add(doc, type, delegateListener);
  2331. add(doc, type, delegateUseCapture, true);
  2332. }
  2333. }
  2334. var delegated = delegatedEvents[type];
  2335. var index;
  2336. for (index = delegated.selectors.length - 1; index >= 0; index--) {
  2337. if (delegated.selectors[index] === selector && delegated.contexts[index] === context) {
  2338. break;
  2339. }
  2340. }
  2341. if (index === -1) {
  2342. index = delegated.selectors.length;
  2343. delegated.selectors.push(selector);
  2344. delegated.contexts.push(context);
  2345. delegated.listeners.push([]);
  2346. } // keep listener and capture and passive flags
  2347. delegated.listeners[index].push([listener, !!options.capture, options.passive]);
  2348. }
  2349. function removeDelegate(selector, context, type, listener, optionalArg) {
  2350. var options = getOptions(optionalArg);
  2351. var delegated = delegatedEvents[type];
  2352. var matchFound = false;
  2353. var index;
  2354. if (!delegated) {
  2355. return;
  2356. } // count from last index of delegated to 0
  2357. for (index = delegated.selectors.length - 1; index >= 0; index--) {
  2358. // look for matching selector and context Node
  2359. if (delegated.selectors[index] === selector && delegated.contexts[index] === context) {
  2360. var listeners = delegated.listeners[index]; // each item of the listeners array is an array: [function, capture, passive]
  2361. for (var i = listeners.length - 1; i >= 0; i--) {
  2362. var _listeners$i = _slicedToArray(listeners[i], 3),
  2363. fn = _listeners$i[0],
  2364. capture = _listeners$i[1],
  2365. passive = _listeners$i[2]; // check if the listener functions and capture and passive flags match
  2366. if (fn === listener && capture === !!options.capture && passive === options.passive) {
  2367. // remove the listener from the array of listeners
  2368. listeners.splice(i, 1); // if all listeners for this interactable have been removed
  2369. // remove the interactable from the delegated arrays
  2370. if (!listeners.length) {
  2371. delegated.selectors.splice(index, 1);
  2372. delegated.contexts.splice(index, 1);
  2373. delegated.listeners.splice(index, 1); // remove delegate function from context
  2374. __remove_51(context, type, delegateListener);
  2375. __remove_51(context, type, delegateUseCapture, true); // remove the arrays if they are empty
  2376. if (!delegated.selectors.length) {
  2377. delegatedEvents[type] = null;
  2378. }
  2379. } // only remove one listener
  2380. matchFound = true;
  2381. break;
  2382. }
  2383. }
  2384. if (matchFound) {
  2385. break;
  2386. }
  2387. }
  2388. }
  2389. } // bound to the interactable context when a DOM event
  2390. // listener is added to a selector interactable
  2391. function delegateListener(event, optionalArg) {
  2392. var options = getOptions(optionalArg);
  2393. var fakeEvent = new FakeEvent(event);
  2394. var delegated = delegatedEvents[event.type];
  2395. var _pointerUtils$getEven = _pointerUtils["default"].getEventTargets(event),
  2396. _pointerUtils$getEven2 = _slicedToArray(_pointerUtils$getEven, 1),
  2397. eventTarget = _pointerUtils$getEven2[0];
  2398. var element = eventTarget; // climb up document tree looking for selector matches
  2399. while (__is_51.element(element)) {
  2400. for (var i = 0; i < delegated.selectors.length; i++) {
  2401. var selector = delegated.selectors[i];
  2402. var context = delegated.contexts[i];
  2403. if (__domUtils_51.matchesSelector(element, selector) && __domUtils_51.nodeContains(context, eventTarget) && __domUtils_51.nodeContains(context, element)) {
  2404. var listeners = delegated.listeners[i];
  2405. fakeEvent.currentTarget = element;
  2406. for (var _i3 = 0; _i3 < listeners.length; _i3++) {
  2407. var _ref;
  2408. _ref = listeners[_i3];
  2409. var _ref2 = _ref,
  2410. _ref3 = _slicedToArray(_ref2, 3),
  2411. fn = _ref3[0],
  2412. capture = _ref3[1],
  2413. passive = _ref3[2];
  2414. if (capture === !!options.capture && passive === options.passive) {
  2415. fn(fakeEvent);
  2416. }
  2417. }
  2418. }
  2419. }
  2420. element = __domUtils_51.parentNode(element);
  2421. }
  2422. }
  2423. function delegateUseCapture(event) {
  2424. return delegateListener.call(this, event, true);
  2425. }
  2426. function getOptions(param) {
  2427. return __is_51.object(param) ? param : {
  2428. capture: param
  2429. };
  2430. }
  2431. var FakeEvent =
  2432. /*#__PURE__*/
  2433. function () {
  2434. function FakeEvent(originalEvent) {
  2435. _classCallCheck(this, FakeEvent);
  2436. this.originalEvent = originalEvent; // duplicate the event so that currentTarget can be changed
  2437. (0, ___pointerExtend_51["default"])(this, originalEvent);
  2438. }
  2439. _createClass(FakeEvent, [{
  2440. key: "preventOriginalDefault",
  2441. value: function preventOriginalDefault() {
  2442. this.originalEvent.preventDefault();
  2443. }
  2444. }, {
  2445. key: "stopPropagation",
  2446. value: function stopPropagation() {
  2447. this.originalEvent.stopPropagation();
  2448. }
  2449. }, {
  2450. key: "stopImmediatePropagation",
  2451. value: function stopImmediatePropagation() {
  2452. this.originalEvent.stopImmediatePropagation();
  2453. }
  2454. }]);
  2455. return FakeEvent;
  2456. }();
  2457. _$events_51.FakeEvent = FakeEvent;
  2458. var events = {
  2459. add: add,
  2460. remove: __remove_51,
  2461. addDelegate: addDelegate,
  2462. removeDelegate: removeDelegate,
  2463. delegateListener: delegateListener,
  2464. delegateUseCapture: delegateUseCapture,
  2465. delegatedEvents: delegatedEvents,
  2466. documents: documents,
  2467. supportsOptions: false,
  2468. supportsPassive: false,
  2469. _elements: elements,
  2470. _targets: targets,
  2471. init: function init(window) {
  2472. window.document.createElement('div').addEventListener('test', null, {
  2473. get capture() {
  2474. return events.supportsOptions = true;
  2475. },
  2476. get passive() {
  2477. return events.supportsPassive = true;
  2478. }
  2479. });
  2480. }
  2481. };
  2482. var ___default_51 = events;
  2483. _$events_51["default"] = ___default_51;
  2484. var _$extend_52 = {};
  2485. "use strict";
  2486. Object.defineProperty(_$extend_52, "__esModule", {
  2487. value: true
  2488. });
  2489. _$extend_52["default"] = extend;
  2490. function extend(dest, source) {
  2491. for (var prop in source) {
  2492. dest[prop] = source[prop];
  2493. }
  2494. return dest;
  2495. }
  2496. var _$rect_62 = {};
  2497. "use strict";
  2498. Object.defineProperty(_$rect_62, "__esModule", {
  2499. value: true
  2500. });
  2501. _$rect_62.getStringOptionResult = getStringOptionResult;
  2502. _$rect_62.resolveRectLike = resolveRectLike;
  2503. _$rect_62.rectToXY = rectToXY;
  2504. _$rect_62.xywhToTlbr = xywhToTlbr;
  2505. _$rect_62.tlbrToXywh = tlbrToXywh;
  2506. _$rect_62["default"] = void 0;
  2507. /* removed: var _$domUtils_50 = require("./domUtils"); */;
  2508. var _extend = ___interopRequireDefault_62(_$extend_52);
  2509. var __is_62 = ___interopRequireWildcard_62(_$is_56);
  2510. function ___interopRequireWildcard_62(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2511. function ___interopRequireDefault_62(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2512. function getStringOptionResult(value, interactable, element) {
  2513. if (!__is_62.string(value)) {
  2514. return null;
  2515. }
  2516. if (value === 'parent') {
  2517. value = (0, _$domUtils_50.parentNode)(element);
  2518. } else if (value === 'self') {
  2519. value = interactable.getRect(element);
  2520. } else {
  2521. value = (0, _$domUtils_50.closest)(element, value);
  2522. }
  2523. return value;
  2524. }
  2525. function resolveRectLike(value, interactable, element, functionArgs) {
  2526. value = getStringOptionResult(value, interactable, element) || value;
  2527. if (__is_62.func(value)) {
  2528. value = value.apply(null, functionArgs);
  2529. }
  2530. if (__is_62.element(value)) {
  2531. value = (0, _$domUtils_50.getElementRect)(value);
  2532. }
  2533. return value;
  2534. }
  2535. function rectToXY(rect) {
  2536. return rect && {
  2537. x: 'x' in rect ? rect.x : rect.left,
  2538. y: 'y' in rect ? rect.y : rect.top
  2539. };
  2540. }
  2541. function xywhToTlbr(rect) {
  2542. if (rect && !('left' in rect && 'top' in rect)) {
  2543. rect = (0, _extend["default"])({}, rect);
  2544. rect.left = rect.x || 0;
  2545. rect.top = rect.y || 0;
  2546. rect.right = rect.right || rect.left + rect.width;
  2547. rect.bottom = rect.bottom || rect.top + rect.height;
  2548. }
  2549. return rect;
  2550. }
  2551. function tlbrToXywh(rect) {
  2552. if (rect && !('x' in rect && 'y' in rect)) {
  2553. rect = (0, _extend["default"])({}, rect);
  2554. rect.x = rect.left || 0;
  2555. rect.y = rect.top || 0;
  2556. rect.width = rect.width || rect.right - rect.x;
  2557. rect.height = rect.height || rect.bottom - rect.y;
  2558. }
  2559. return rect;
  2560. }
  2561. var ___default_62 = {
  2562. getStringOptionResult: getStringOptionResult,
  2563. resolveRectLike: resolveRectLike,
  2564. rectToXY: rectToXY,
  2565. xywhToTlbr: xywhToTlbr,
  2566. tlbrToXywh: tlbrToXywh
  2567. };
  2568. _$rect_62["default"] = ___default_62;
  2569. var _$getOriginXY_53 = {};
  2570. "use strict";
  2571. Object.defineProperty(_$getOriginXY_53, "__esModule", {
  2572. value: true
  2573. });
  2574. _$getOriginXY_53["default"] = ___default_53;
  2575. /* removed: var _$rect_62 = require("./rect"); */;
  2576. function ___default_53(target, element, action) {
  2577. var actionOptions = target.options[action];
  2578. var actionOrigin = actionOptions && actionOptions.origin;
  2579. var origin = actionOrigin || target.options.origin;
  2580. var originRect = (0, _$rect_62.resolveRectLike)(origin, target, element, [target && element]);
  2581. return (0, _$rect_62.rectToXY)(originRect) || {
  2582. x: 0,
  2583. y: 0
  2584. };
  2585. }
  2586. var _$normalizeListeners_58 = {};
  2587. "use strict";
  2588. Object.defineProperty(_$normalizeListeners_58, "__esModule", {
  2589. value: true
  2590. });
  2591. _$normalizeListeners_58["default"] = normalize;
  2592. var ___extend_58 = ___interopRequireDefault_58(_$extend_52);
  2593. var __is_58 = ___interopRequireWildcard_58(_$is_56);
  2594. function ___interopRequireWildcard_58(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2595. function ___interopRequireDefault_58(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2596. function normalize(type, listeners, result) {
  2597. result = result || {};
  2598. if (__is_58.string(type) && type.search(' ') !== -1) {
  2599. type = split(type);
  2600. }
  2601. if (__is_58.array(type)) {
  2602. return type.reduce(function (acc, t) {
  2603. return (0, ___extend_58["default"])(acc, normalize(t, listeners, result));
  2604. }, result);
  2605. } // ({ type: fn }) -> ('', { type: fn })
  2606. if (__is_58.object(type)) {
  2607. listeners = type;
  2608. type = '';
  2609. }
  2610. if (__is_58.func(listeners)) {
  2611. result[type] = result[type] || [];
  2612. result[type].push(listeners);
  2613. } else if (__is_58.array(listeners)) {
  2614. for (var _i = 0; _i < listeners.length; _i++) {
  2615. var _ref;
  2616. _ref = listeners[_i];
  2617. var l = _ref;
  2618. normalize(type, l, result);
  2619. }
  2620. } else if (__is_58.object(listeners)) {
  2621. for (var prefix in listeners) {
  2622. var combinedTypes = split(prefix).map(function (p) {
  2623. return "".concat(type).concat(p);
  2624. });
  2625. normalize(combinedTypes, listeners[prefix], result);
  2626. }
  2627. }
  2628. return result;
  2629. }
  2630. function split(type) {
  2631. return type.trim().split(/ +/);
  2632. }
  2633. var _$raf_61 = {};
  2634. "use strict";
  2635. Object.defineProperty(_$raf_61, "__esModule", {
  2636. value: true
  2637. });
  2638. _$raf_61["default"] = void 0;
  2639. var lastTime = 0;
  2640. var _request;
  2641. var _cancel;
  2642. function __init_61(window) {
  2643. _request = window.requestAnimationFrame;
  2644. _cancel = window.cancelAnimationFrame;
  2645. if (!_request) {
  2646. var vendors = ['ms', 'moz', 'webkit', 'o'];
  2647. for (var _i = 0; _i < vendors.length; _i++) {
  2648. var vendor = vendors[_i];
  2649. _request = window["".concat(vendor, "RequestAnimationFrame")];
  2650. _cancel = window["".concat(vendor, "CancelAnimationFrame")] || window["".concat(vendor, "CancelRequestAnimationFrame")];
  2651. }
  2652. }
  2653. if (!_request) {
  2654. _request = function request(callback) {
  2655. var currTime = Date.now();
  2656. var timeToCall = Math.max(0, 16 - (currTime - lastTime)); // eslint-disable-next-line standard/no-callback-literal
  2657. var token = setTimeout(function () {
  2658. callback(currTime + timeToCall);
  2659. }, timeToCall);
  2660. lastTime = currTime + timeToCall;
  2661. return token;
  2662. };
  2663. _cancel = function cancel(token) {
  2664. return clearTimeout(token);
  2665. };
  2666. }
  2667. }
  2668. var ___default_61 = {
  2669. request: function request(callback) {
  2670. return _request(callback);
  2671. },
  2672. cancel: function cancel(token) {
  2673. return _cancel(token);
  2674. },
  2675. init: __init_61
  2676. };
  2677. _$raf_61["default"] = ___default_61;
  2678. var _$Signals_45 = {};
  2679. "use strict";
  2680. Object.defineProperty(_$Signals_45, "__esModule", {
  2681. value: true
  2682. });
  2683. _$Signals_45["default"] = void 0;
  2684. function ___classCallCheck_45(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2685. function ___defineProperties_45(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2686. function ___createClass_45(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_45(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_45(Constructor, staticProps); return Constructor; }
  2687. var Signals =
  2688. /*#__PURE__*/
  2689. function () {
  2690. function Signals() {
  2691. ___classCallCheck_45(this, Signals);
  2692. this.listeners = {};
  2693. }
  2694. ___createClass_45(Signals, [{
  2695. key: "on",
  2696. value: function on(name, listener) {
  2697. if (!this.listeners[name]) {
  2698. this.listeners[name] = [listener];
  2699. return;
  2700. }
  2701. this.listeners[name].push(listener);
  2702. }
  2703. }, {
  2704. key: "off",
  2705. value: function off(name, listener) {
  2706. if (!this.listeners[name]) {
  2707. return;
  2708. }
  2709. var index = this.listeners[name].indexOf(listener);
  2710. if (index !== -1) {
  2711. this.listeners[name].splice(index, 1);
  2712. }
  2713. }
  2714. }, {
  2715. key: "fire",
  2716. value: function fire(name, arg) {
  2717. var targetListeners = this.listeners[name];
  2718. if (!targetListeners) {
  2719. return;
  2720. }
  2721. for (var _i = 0; _i < targetListeners.length; _i++) {
  2722. var _ref;
  2723. _ref = targetListeners[_i];
  2724. var listener = _ref;
  2725. if (listener(arg, name) === false) {
  2726. return false;
  2727. }
  2728. }
  2729. }
  2730. }]);
  2731. return Signals;
  2732. }();
  2733. var ___default_45 = Signals;
  2734. _$Signals_45["default"] = ___default_45;
  2735. var _$utils_55 = {};
  2736. "use strict";
  2737. Object.defineProperty(_$utils_55, "__esModule", {
  2738. value: true
  2739. });
  2740. _$utils_55.warnOnce = warnOnce;
  2741. _$utils_55._getQBezierValue = _getQBezierValue;
  2742. _$utils_55.getQuadraticCurvePoint = getQuadraticCurvePoint;
  2743. _$utils_55.easeOutQuad = easeOutQuad;
  2744. _$utils_55.copyAction = copyAction;
  2745. Object.defineProperty(_$utils_55, "win", {
  2746. enumerable: true,
  2747. get: function get() {
  2748. return ___window_55["default"];
  2749. }
  2750. });
  2751. Object.defineProperty(_$utils_55, "browser", {
  2752. enumerable: true,
  2753. get: function get() {
  2754. return ___browser_55["default"];
  2755. }
  2756. });
  2757. Object.defineProperty(_$utils_55, "clone", {
  2758. enumerable: true,
  2759. get: function get() {
  2760. return _clone["default"];
  2761. }
  2762. });
  2763. Object.defineProperty(_$utils_55, "events", {
  2764. enumerable: true,
  2765. get: function get() {
  2766. return _events["default"];
  2767. }
  2768. });
  2769. Object.defineProperty(_$utils_55, "extend", {
  2770. enumerable: true,
  2771. get: function get() {
  2772. return ___extend_55["default"];
  2773. }
  2774. });
  2775. Object.defineProperty(_$utils_55, "getOriginXY", {
  2776. enumerable: true,
  2777. get: function get() {
  2778. return _getOriginXY["default"];
  2779. }
  2780. });
  2781. Object.defineProperty(_$utils_55, "hypot", {
  2782. enumerable: true,
  2783. get: function get() {
  2784. return ___hypot_55["default"];
  2785. }
  2786. });
  2787. Object.defineProperty(_$utils_55, "normalizeListeners", {
  2788. enumerable: true,
  2789. get: function get() {
  2790. return _normalizeListeners["default"];
  2791. }
  2792. });
  2793. Object.defineProperty(_$utils_55, "pointer", {
  2794. enumerable: true,
  2795. get: function get() {
  2796. return ___pointerUtils_55["default"];
  2797. }
  2798. });
  2799. Object.defineProperty(_$utils_55, "raf", {
  2800. enumerable: true,
  2801. get: function get() {
  2802. return _raf["default"];
  2803. }
  2804. });
  2805. Object.defineProperty(_$utils_55, "rect", {
  2806. enumerable: true,
  2807. get: function get() {
  2808. return ___rect_55["default"];
  2809. }
  2810. });
  2811. Object.defineProperty(_$utils_55, "Signals", {
  2812. enumerable: true,
  2813. get: function get() {
  2814. return _Signals["default"];
  2815. }
  2816. });
  2817. _$utils_55.is = _$utils_55.dom = _$utils_55.arr = void 0;
  2818. var __arr_55 = ___interopRequireWildcard_55(_$arr_46);
  2819. _$utils_55.arr = __arr_55;
  2820. var dom = ___interopRequireWildcard_55(_$domUtils_50);
  2821. _$utils_55.dom = dom;
  2822. var __is_55 = ___interopRequireWildcard_55(_$is_56);
  2823. _$utils_55.is = __is_55;
  2824. var ___window_55 = ___interopRequireDefault_55(_$window_65);
  2825. var ___browser_55 = ___interopRequireDefault_55(_$browser_47);
  2826. var _clone = ___interopRequireDefault_55(_$clone_48);
  2827. var _events = ___interopRequireDefault_55(_$events_51);
  2828. var ___extend_55 = ___interopRequireDefault_55(_$extend_52);
  2829. var _getOriginXY = ___interopRequireDefault_55(_$getOriginXY_53);
  2830. var ___hypot_55 = ___interopRequireDefault_55(_$hypot_54);
  2831. var _normalizeListeners = ___interopRequireDefault_55(_$normalizeListeners_58);
  2832. var ___pointerUtils_55 = ___interopRequireDefault_55(_$pointerUtils_60);
  2833. var _raf = ___interopRequireDefault_55(_$raf_61);
  2834. var ___rect_55 = ___interopRequireDefault_55(_$rect_62);
  2835. var _Signals = ___interopRequireDefault_55(_$Signals_45);
  2836. function ___interopRequireDefault_55(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2837. function ___interopRequireWildcard_55(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2838. function warnOnce(method, message) {
  2839. var warned = false; // eslint-disable-next-line no-shadow
  2840. return function () {
  2841. if (!warned) {
  2842. ___window_55["default"].window.console.warn(message);
  2843. warned = true;
  2844. }
  2845. return method.apply(this, arguments);
  2846. };
  2847. } // http://stackoverflow.com/a/5634528/2280888
  2848. function _getQBezierValue(t, p1, p2, p3) {
  2849. var iT = 1 - t;
  2850. return iT * iT * p1 + 2 * iT * t * p2 + t * t * p3;
  2851. }
  2852. function getQuadraticCurvePoint(startX, startY, cpX, cpY, endX, endY, position) {
  2853. return {
  2854. x: _getQBezierValue(position, startX, cpX, endX),
  2855. y: _getQBezierValue(position, startY, cpY, endY)
  2856. };
  2857. } // http://gizma.com/easing/
  2858. function easeOutQuad(t, b, c, d) {
  2859. t /= d;
  2860. return -c * t * (t - 2) + b;
  2861. }
  2862. function copyAction(dest, src) {
  2863. dest.name = src.name;
  2864. dest.axis = src.axis;
  2865. dest.edges = src.edges;
  2866. return dest;
  2867. }
  2868. var _$defaultOptions_20 = {};
  2869. "use strict";
  2870. Object.defineProperty(_$defaultOptions_20, "__esModule", {
  2871. value: true
  2872. });
  2873. _$defaultOptions_20["default"] = _$defaultOptions_20.defaults = void 0;
  2874. // tslint:disable no-empty-interface
  2875. var defaults = {
  2876. base: {
  2877. preventDefault: 'auto',
  2878. deltaSource: 'page'
  2879. },
  2880. perAction: {
  2881. enabled: false,
  2882. origin: {
  2883. x: 0,
  2884. y: 0
  2885. }
  2886. },
  2887. actions: {}
  2888. };
  2889. _$defaultOptions_20.defaults = defaults;
  2890. var ___default_20 = defaults;
  2891. _$defaultOptions_20["default"] = ___default_20;
  2892. var _$Eventable_14 = {};
  2893. "use strict";
  2894. Object.defineProperty(_$Eventable_14, "__esModule", {
  2895. value: true
  2896. });
  2897. _$Eventable_14["default"] = void 0;
  2898. var __arr_14 = ___interopRequireWildcard_14(_$arr_46);
  2899. var ___extend_14 = ___interopRequireDefault_14(_$extend_52);
  2900. var ___normalizeListeners_14 = ___interopRequireDefault_14(_$normalizeListeners_58);
  2901. function ___interopRequireDefault_14(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2902. function ___interopRequireWildcard_14(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2903. function ___classCallCheck_14(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2904. function ___defineProperties_14(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2905. function ___createClass_14(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_14(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_14(Constructor, staticProps); return Constructor; }
  2906. function fireUntilImmediateStopped(event, listeners) {
  2907. for (var _i = 0; _i < listeners.length; _i++) {
  2908. var _ref;
  2909. _ref = listeners[_i];
  2910. var listener = _ref;
  2911. if (event.immediatePropagationStopped) {
  2912. break;
  2913. }
  2914. listener(event);
  2915. }
  2916. }
  2917. var Eventable =
  2918. /*#__PURE__*/
  2919. function () {
  2920. function Eventable(options) {
  2921. ___classCallCheck_14(this, Eventable);
  2922. this.types = {};
  2923. this.propagationStopped = false;
  2924. this.immediatePropagationStopped = false;
  2925. this.options = (0, ___extend_14["default"])({}, options || {});
  2926. }
  2927. ___createClass_14(Eventable, [{
  2928. key: "fire",
  2929. value: function fire(event) {
  2930. var listeners;
  2931. var global = this.global; // Interactable#on() listeners
  2932. // tslint:disable no-conditional-assignment
  2933. if (listeners = this.types[event.type]) {
  2934. fireUntilImmediateStopped(event, listeners);
  2935. } // interact.on() listeners
  2936. if (!event.propagationStopped && global && (listeners = global[event.type])) {
  2937. fireUntilImmediateStopped(event, listeners);
  2938. }
  2939. }
  2940. }, {
  2941. key: "on",
  2942. value: function on(type, listener) {
  2943. var listeners = (0, ___normalizeListeners_14["default"])(type, listener);
  2944. for (type in listeners) {
  2945. this.types[type] = __arr_14.merge(this.types[type] || [], listeners[type]);
  2946. }
  2947. }
  2948. }, {
  2949. key: "off",
  2950. value: function off(type, listener) {
  2951. var listeners = (0, ___normalizeListeners_14["default"])(type, listener);
  2952. for (type in listeners) {
  2953. var eventList = this.types[type];
  2954. if (!eventList || !eventList.length) {
  2955. continue;
  2956. }
  2957. for (var _i2 = 0; _i2 < listeners[type].length; _i2++) {
  2958. var _ref2;
  2959. _ref2 = listeners[type][_i2];
  2960. var subListener = _ref2;
  2961. var index = eventList.indexOf(subListener);
  2962. if (index !== -1) {
  2963. eventList.splice(index, 1);
  2964. }
  2965. }
  2966. }
  2967. }
  2968. }]);
  2969. return Eventable;
  2970. }();
  2971. var ___default_14 = Eventable;
  2972. _$Eventable_14["default"] = ___default_14;
  2973. var _$Interactable_16 = {};
  2974. "use strict";
  2975. Object.defineProperty(_$Interactable_16, "__esModule", {
  2976. value: true
  2977. });
  2978. _$Interactable_16["default"] = _$Interactable_16.Interactable = void 0;
  2979. var __arr_16 = ___interopRequireWildcard_16(_$arr_46);
  2980. var ___browser_16 = ___interopRequireDefault_16(_$browser_47);
  2981. var ___clone_16 = ___interopRequireDefault_16(_$clone_48);
  2982. /* removed: var _$domUtils_50 = require("@interactjs/utils/domUtils"); */;
  2983. var ___events_16 = ___interopRequireDefault_16(_$events_51);
  2984. var ___extend_16 = ___interopRequireDefault_16(_$extend_52);
  2985. var __is_16 = ___interopRequireWildcard_16(_$is_56);
  2986. var ___normalizeListeners_16 = ___interopRequireDefault_16(_$normalizeListeners_58);
  2987. /* removed: var _$window_65 = require("@interactjs/utils/window"); */;
  2988. var _Eventable = ___interopRequireDefault_16(_$Eventable_14);
  2989. function ___interopRequireDefault_16(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  2990. function ___interopRequireWildcard_16(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  2991. function ___classCallCheck_16(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2992. function ___defineProperties_16(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  2993. function ___createClass_16(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_16(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_16(Constructor, staticProps); return Constructor; }
  2994. /** */
  2995. var Interactable =
  2996. /*#__PURE__*/
  2997. function () {
  2998. /** */
  2999. function Interactable(target, options, defaultContext) {
  3000. ___classCallCheck_16(this, Interactable);
  3001. this.events = new _Eventable["default"]();
  3002. this._actions = options.actions;
  3003. this.target = target;
  3004. this._context = options.context || defaultContext;
  3005. this._win = (0, _$window_65.getWindow)((0, _$domUtils_50.trySelector)(target) ? this._context : target);
  3006. this._doc = this._win.document;
  3007. this.set(options);
  3008. }
  3009. ___createClass_16(Interactable, [{
  3010. key: "setOnEvents",
  3011. value: function setOnEvents(actionName, phases) {
  3012. if (__is_16.func(phases.onstart)) {
  3013. this.on("".concat(actionName, "start"), phases.onstart);
  3014. }
  3015. if (__is_16.func(phases.onmove)) {
  3016. this.on("".concat(actionName, "move"), phases.onmove);
  3017. }
  3018. if (__is_16.func(phases.onend)) {
  3019. this.on("".concat(actionName, "end"), phases.onend);
  3020. }
  3021. if (__is_16.func(phases.oninertiastart)) {
  3022. this.on("".concat(actionName, "inertiastart"), phases.oninertiastart);
  3023. }
  3024. return this;
  3025. }
  3026. }, {
  3027. key: "updatePerActionListeners",
  3028. value: function updatePerActionListeners(actionName, prev, cur) {
  3029. if (__is_16.array(prev) || __is_16.object(prev)) {
  3030. this.off(actionName, prev);
  3031. }
  3032. if (__is_16.array(cur) || __is_16.object(cur)) {
  3033. this.on(actionName, cur);
  3034. }
  3035. }
  3036. }, {
  3037. key: "setPerAction",
  3038. value: function setPerAction(actionName, options) {
  3039. var defaults = this._defaults; // for all the default per-action options
  3040. for (var optionName in options) {
  3041. var actionOptions = this.options[actionName];
  3042. var optionValue = options[optionName];
  3043. var isArray = __is_16.array(optionValue); // remove old event listeners and add new ones
  3044. if (optionName === 'listeners') {
  3045. this.updatePerActionListeners(actionName, actionOptions.listeners, optionValue);
  3046. } // if the option value is an array
  3047. if (isArray) {
  3048. actionOptions[optionName] = __arr_16.from(optionValue);
  3049. } // if the option value is an object
  3050. else if (!isArray && __is_16.plainObject(optionValue)) {
  3051. // copy the object
  3052. actionOptions[optionName] = (0, ___extend_16["default"])(actionOptions[optionName] || {}, (0, ___clone_16["default"])(optionValue)); // set anabled field to true if it exists in the defaults
  3053. if (__is_16.object(defaults.perAction[optionName]) && 'enabled' in defaults.perAction[optionName]) {
  3054. actionOptions[optionName].enabled = optionValue.enabled !== false;
  3055. }
  3056. } // if the option value is a boolean and the default is an object
  3057. else if (__is_16.bool(optionValue) && __is_16.object(defaults.perAction[optionName])) {
  3058. actionOptions[optionName].enabled = optionValue;
  3059. } // if it's anything else, do a plain assignment
  3060. else {
  3061. actionOptions[optionName] = optionValue;
  3062. }
  3063. }
  3064. }
  3065. /**
  3066. * The default function to get an Interactables bounding rect. Can be
  3067. * overridden using {@link Interactable.rectChecker}.
  3068. *
  3069. * @param {Element} [element] The element to measure.
  3070. * @return {object} The object's bounding rectangle.
  3071. */
  3072. }, {
  3073. key: "getRect",
  3074. value: function getRect(element) {
  3075. element = element || (__is_16.element(this.target) ? this.target : null);
  3076. if (__is_16.string(this.target)) {
  3077. element = element || this._context.querySelector(this.target);
  3078. }
  3079. return (0, _$domUtils_50.getElementRect)(element);
  3080. }
  3081. /**
  3082. * Returns or sets the function used to calculate the interactable's
  3083. * element's rectangle
  3084. *
  3085. * @param {function} [checker] A function which returns this Interactable's
  3086. * bounding rectangle. See {@link Interactable.getRect}
  3087. * @return {function | object} The checker function or this Interactable
  3088. */
  3089. }, {
  3090. key: "rectChecker",
  3091. value: function rectChecker(checker) {
  3092. if (__is_16.func(checker)) {
  3093. this.getRect = checker;
  3094. return this;
  3095. }
  3096. if (checker === null) {
  3097. delete this.getRect;
  3098. return this;
  3099. }
  3100. return this.getRect;
  3101. }
  3102. }, {
  3103. key: "_backCompatOption",
  3104. value: function _backCompatOption(optionName, newValue) {
  3105. if ((0, _$domUtils_50.trySelector)(newValue) || __is_16.object(newValue)) {
  3106. this.options[optionName] = newValue;
  3107. for (var _i = 0; _i < this._actions.names.length; _i++) {
  3108. var _ref;
  3109. _ref = this._actions.names[_i];
  3110. var action = _ref;
  3111. this.options[action][optionName] = newValue;
  3112. }
  3113. return this;
  3114. }
  3115. return this.options[optionName];
  3116. }
  3117. /**
  3118. * Gets or sets the origin of the Interactable's element. The x and y
  3119. * of the origin will be subtracted from action event coordinates.
  3120. *
  3121. * @param {Element | object | string} [origin] An HTML or SVG Element whose
  3122. * rect will be used, an object eg. { x: 0, y: 0 } or string 'parent', 'self'
  3123. * or any CSS selector
  3124. *
  3125. * @return {object} The current origin or this Interactable
  3126. */
  3127. }, {
  3128. key: "origin",
  3129. value: function origin(newValue) {
  3130. return this._backCompatOption('origin', newValue);
  3131. }
  3132. /**
  3133. * Returns or sets the mouse coordinate types used to calculate the
  3134. * movement of the pointer.
  3135. *
  3136. * @param {string} [newValue] Use 'client' if you will be scrolling while
  3137. * interacting; Use 'page' if you want autoScroll to work
  3138. * @return {string | object} The current deltaSource or this Interactable
  3139. */
  3140. }, {
  3141. key: "deltaSource",
  3142. value: function deltaSource(newValue) {
  3143. if (newValue === 'page' || newValue === 'client') {
  3144. this.options.deltaSource = newValue;
  3145. return this;
  3146. }
  3147. return this.options.deltaSource;
  3148. }
  3149. /**
  3150. * Gets the selector context Node of the Interactable. The default is
  3151. * `window.document`.
  3152. *
  3153. * @return {Node} The context Node of this Interactable
  3154. */
  3155. }, {
  3156. key: "context",
  3157. value: function context() {
  3158. return this._context;
  3159. }
  3160. }, {
  3161. key: "inContext",
  3162. value: function inContext(element) {
  3163. return this._context === element.ownerDocument || (0, _$domUtils_50.nodeContains)(this._context, element);
  3164. }
  3165. }, {
  3166. key: "testIgnoreAllow",
  3167. value: function testIgnoreAllow(options, targetNode, eventTarget) {
  3168. return !this.testIgnore(options.ignoreFrom, targetNode, eventTarget) && this.testAllow(options.allowFrom, targetNode, eventTarget);
  3169. }
  3170. }, {
  3171. key: "testAllow",
  3172. value: function testAllow(allowFrom, targetNode, element) {
  3173. if (!allowFrom) {
  3174. return true;
  3175. }
  3176. if (!__is_16.element(element)) {
  3177. return false;
  3178. }
  3179. if (__is_16.string(allowFrom)) {
  3180. return (0, _$domUtils_50.matchesUpTo)(element, allowFrom, targetNode);
  3181. } else if (__is_16.element(allowFrom)) {
  3182. return (0, _$domUtils_50.nodeContains)(allowFrom, element);
  3183. }
  3184. return false;
  3185. }
  3186. }, {
  3187. key: "testIgnore",
  3188. value: function testIgnore(ignoreFrom, targetNode, element) {
  3189. if (!ignoreFrom || !__is_16.element(element)) {
  3190. return false;
  3191. }
  3192. if (__is_16.string(ignoreFrom)) {
  3193. return (0, _$domUtils_50.matchesUpTo)(element, ignoreFrom, targetNode);
  3194. } else if (__is_16.element(ignoreFrom)) {
  3195. return (0, _$domUtils_50.nodeContains)(ignoreFrom, element);
  3196. }
  3197. return false;
  3198. }
  3199. /**
  3200. * Calls listeners for the given InteractEvent type bound globally
  3201. * and directly to this Interactable
  3202. *
  3203. * @param {InteractEvent} iEvent The InteractEvent object to be fired on this
  3204. * Interactable
  3205. * @return {Interactable} this Interactable
  3206. */
  3207. }, {
  3208. key: "fire",
  3209. value: function fire(iEvent) {
  3210. this.events.fire(iEvent);
  3211. return this;
  3212. }
  3213. }, {
  3214. key: "_onOff",
  3215. value: function _onOff(method, typeArg, listenerArg, options) {
  3216. if (__is_16.object(typeArg) && !__is_16.array(typeArg)) {
  3217. options = listenerArg;
  3218. listenerArg = null;
  3219. }
  3220. var addRemove = method === 'on' ? 'add' : 'remove';
  3221. var listeners = (0, ___normalizeListeners_16["default"])(typeArg, listenerArg);
  3222. for (var type in listeners) {
  3223. if (type === 'wheel') {
  3224. type = ___browser_16["default"].wheelEvent;
  3225. }
  3226. for (var _i2 = 0; _i2 < listeners[type].length; _i2++) {
  3227. var _ref2;
  3228. _ref2 = listeners[type][_i2];
  3229. var listener = _ref2;
  3230. // if it is an action event type
  3231. if (__arr_16.contains(this._actions.eventTypes, type)) {
  3232. this.events[method](type, listener);
  3233. } // delegated event
  3234. else if (__is_16.string(this.target)) {
  3235. ___events_16["default"]["".concat(addRemove, "Delegate")](this.target, this._context, type, listener, options);
  3236. } // remove listener from this Interatable's element
  3237. else {
  3238. ___events_16["default"][addRemove](this.target, type, listener, options);
  3239. }
  3240. }
  3241. }
  3242. return this;
  3243. }
  3244. /**
  3245. * Binds a listener for an InteractEvent, pointerEvent or DOM event.
  3246. *
  3247. * @param {string | array | object} types The types of events to listen
  3248. * for
  3249. * @param {function | array | object} [listener] The event listener function(s)
  3250. * @param {object | boolean} [options] options object or useCapture flag for
  3251. * addEventListener
  3252. * @return {Interactable} This Interactable
  3253. */
  3254. }, {
  3255. key: "on",
  3256. value: function on(types, listener, options) {
  3257. return this._onOff('on', types, listener, options);
  3258. }
  3259. /**
  3260. * Removes an InteractEvent, pointerEvent or DOM event listener.
  3261. *
  3262. * @param {string | array | object} types The types of events that were
  3263. * listened for
  3264. * @param {function | array | object} [listener] The event listener function(s)
  3265. * @param {object | boolean} [options] options object or useCapture flag for
  3266. * removeEventListener
  3267. * @return {Interactable} This Interactable
  3268. */
  3269. }, {
  3270. key: "off",
  3271. value: function off(types, listener, options) {
  3272. return this._onOff('off', types, listener, options);
  3273. }
  3274. /**
  3275. * Reset the options of this Interactable
  3276. *
  3277. * @param {object} options The new settings to apply
  3278. * @return {object} This Interactable
  3279. */
  3280. }, {
  3281. key: "set",
  3282. value: function set(options) {
  3283. var defaults = this._defaults;
  3284. if (!__is_16.object(options)) {
  3285. options = {};
  3286. }
  3287. this.options = (0, ___clone_16["default"])(defaults.base);
  3288. for (var actionName in this._actions.methodDict) {
  3289. var methodName = this._actions.methodDict[actionName];
  3290. this.options[actionName] = {};
  3291. this.setPerAction(actionName, (0, ___extend_16["default"])((0, ___extend_16["default"])({}, defaults.perAction), defaults.actions[actionName]));
  3292. this[methodName](options[actionName]);
  3293. }
  3294. for (var setting in options) {
  3295. if (__is_16.func(this[setting])) {
  3296. this[setting](options[setting]);
  3297. }
  3298. }
  3299. return this;
  3300. }
  3301. /**
  3302. * Remove this interactable from the list of interactables and remove it's
  3303. * action capabilities and event listeners
  3304. *
  3305. * @return {interact}
  3306. */
  3307. }, {
  3308. key: "unset",
  3309. value: function unset() {
  3310. ___events_16["default"].remove(this.target, 'all');
  3311. if (__is_16.string(this.target)) {
  3312. // remove delegated events
  3313. for (var type in ___events_16["default"].delegatedEvents) {
  3314. var delegated = ___events_16["default"].delegatedEvents[type];
  3315. if (delegated.selectors[0] === this.target && delegated.contexts[0] === this._context) {
  3316. delegated.selectors.splice(0, 1);
  3317. delegated.contexts.splice(0, 1);
  3318. delegated.listeners.splice(0, 1); // remove the arrays if they are empty
  3319. if (!delegated.selectors.length) {
  3320. delegated[type] = null;
  3321. }
  3322. }
  3323. ___events_16["default"].remove(this._context, type, ___events_16["default"].delegateListener);
  3324. ___events_16["default"].remove(this._context, type, ___events_16["default"].delegateUseCapture, true);
  3325. }
  3326. } else {
  3327. ___events_16["default"].remove(this.target, 'all');
  3328. }
  3329. }
  3330. }, {
  3331. key: "_defaults",
  3332. get: function get() {
  3333. return {
  3334. base: {},
  3335. perAction: {},
  3336. actions: {}
  3337. };
  3338. }
  3339. }]);
  3340. return Interactable;
  3341. }();
  3342. _$Interactable_16.Interactable = Interactable;
  3343. var ___default_16 = Interactable;
  3344. _$Interactable_16["default"] = ___default_16;
  3345. var _$InteractableSet_17 = {};
  3346. "use strict";
  3347. Object.defineProperty(_$InteractableSet_17, "__esModule", {
  3348. value: true
  3349. });
  3350. _$InteractableSet_17["default"] = void 0;
  3351. var __arr_17 = ___interopRequireWildcard_17(_$arr_46);
  3352. var __domUtils_17 = ___interopRequireWildcard_17(_$domUtils_50);
  3353. var ___extend_17 = ___interopRequireDefault_17(_$extend_52);
  3354. var __is_17 = ___interopRequireWildcard_17(_$is_56);
  3355. var ___Signals_17 = ___interopRequireDefault_17(_$Signals_45);
  3356. function ___interopRequireDefault_17(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  3357. function ___interopRequireWildcard_17(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  3358. function ___classCallCheck_17(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3359. function ___defineProperties_17(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3360. function ___createClass_17(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_17(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_17(Constructor, staticProps); return Constructor; }
  3361. var InteractableSet =
  3362. /*#__PURE__*/
  3363. function () {
  3364. function InteractableSet(scope) {
  3365. var _this = this;
  3366. ___classCallCheck_17(this, InteractableSet);
  3367. this.scope = scope;
  3368. this.signals = new ___Signals_17["default"](); // all set interactables
  3369. this.list = [];
  3370. this.selectorMap = {};
  3371. this.signals.on('unset', function (_ref) {
  3372. var interactable = _ref.interactable;
  3373. var target = interactable.target,
  3374. context = interactable._context;
  3375. var targetMappings = __is_17.string(target) ? _this.selectorMap[target] : target[_this.scope.id];
  3376. var targetIndex = targetMappings.findIndex(function (m) {
  3377. return m.context === context;
  3378. });
  3379. if (targetMappings[targetIndex]) {
  3380. // Destroying mappingInfo's context and interactable
  3381. targetMappings[targetIndex].context = null;
  3382. targetMappings[targetIndex].interactable = null;
  3383. }
  3384. targetMappings.splice(targetIndex, 1);
  3385. });
  3386. }
  3387. ___createClass_17(InteractableSet, [{
  3388. key: "new",
  3389. value: function _new(target, options) {
  3390. options = (0, ___extend_17["default"])(options || {}, {
  3391. actions: this.scope.actions
  3392. });
  3393. var interactable = new this.scope.Interactable(target, options, this.scope.document);
  3394. var mappingInfo = {
  3395. context: interactable._context,
  3396. interactable: interactable
  3397. };
  3398. this.scope.addDocument(interactable._doc);
  3399. this.list.push(interactable);
  3400. if (__is_17.string(target)) {
  3401. if (!this.selectorMap[target]) {
  3402. this.selectorMap[target] = [];
  3403. }
  3404. this.selectorMap[target].push(mappingInfo);
  3405. } else {
  3406. if (!interactable.target[this.scope.id]) {
  3407. Object.defineProperty(target, this.scope.id, {
  3408. value: [],
  3409. configurable: true
  3410. });
  3411. }
  3412. target[this.scope.id].push(mappingInfo);
  3413. }
  3414. this.signals.fire('new', {
  3415. target: target,
  3416. options: options,
  3417. interactable: interactable,
  3418. win: this.scope._win
  3419. });
  3420. return interactable;
  3421. }
  3422. }, {
  3423. key: "get",
  3424. value: function get(target, options) {
  3425. var context = options && options.context || this.scope.document;
  3426. var isSelector = __is_17.string(target);
  3427. var targetMappings = isSelector ? this.selectorMap[target] : target[this.scope.id];
  3428. if (!targetMappings) {
  3429. return null;
  3430. }
  3431. var found = __arr_17.find(targetMappings, function (m) {
  3432. return m.context === context && (isSelector || m.interactable.inContext(target));
  3433. });
  3434. return found && found.interactable;
  3435. }
  3436. }, {
  3437. key: "forEachMatch",
  3438. value: function forEachMatch(node, callback) {
  3439. for (var _i = 0; _i < this.list.length; _i++) {
  3440. var _ref2;
  3441. _ref2 = this.list[_i];
  3442. var interactable = _ref2;
  3443. var ret = void 0;
  3444. if ((__is_17.string(interactable.target) // target is a selector and the element matches
  3445. ? __is_17.element(node) && __domUtils_17.matchesSelector(node, interactable.target) : // target is the element
  3446. node === interactable.target) && // the element is in context
  3447. interactable.inContext(node)) {
  3448. ret = callback(interactable);
  3449. }
  3450. if (ret !== undefined) {
  3451. return ret;
  3452. }
  3453. }
  3454. }
  3455. }]);
  3456. return InteractableSet;
  3457. }();
  3458. _$InteractableSet_17["default"] = InteractableSet;
  3459. var _$BaseEvent_13 = {};
  3460. "use strict";
  3461. Object.defineProperty(_$BaseEvent_13, "__esModule", {
  3462. value: true
  3463. });
  3464. _$BaseEvent_13["default"] = _$BaseEvent_13.BaseEvent = _$BaseEvent_13.EventPhase = void 0;
  3465. function ___classCallCheck_13(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3466. function ___defineProperties_13(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3467. function ___createClass_13(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_13(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_13(Constructor, staticProps); return Constructor; }
  3468. var EventPhase;
  3469. _$BaseEvent_13.EventPhase = EventPhase;
  3470. (function (EventPhase) {
  3471. EventPhase["Start"] = "start";
  3472. EventPhase["Move"] = "move";
  3473. EventPhase["End"] = "end";
  3474. EventPhase["_NONE"] = "";
  3475. })(EventPhase || (_$BaseEvent_13.EventPhase = EventPhase = {}));
  3476. var BaseEvent =
  3477. /*#__PURE__*/
  3478. function () {
  3479. function BaseEvent(interaction) {
  3480. ___classCallCheck_13(this, BaseEvent);
  3481. this.immediatePropagationStopped = false;
  3482. this.propagationStopped = false;
  3483. this._interaction = interaction;
  3484. }
  3485. ___createClass_13(BaseEvent, [{
  3486. key: "preventDefault",
  3487. value: function preventDefault() {}
  3488. /**
  3489. * Don't call any other listeners (even on the current target)
  3490. */
  3491. }, {
  3492. key: "stopPropagation",
  3493. value: function stopPropagation() {
  3494. this.propagationStopped = true;
  3495. }
  3496. /**
  3497. * Don't call listeners on the remaining targets
  3498. */
  3499. }, {
  3500. key: "stopImmediatePropagation",
  3501. value: function stopImmediatePropagation() {
  3502. this.immediatePropagationStopped = this.propagationStopped = true;
  3503. }
  3504. }, {
  3505. key: "interaction",
  3506. get: function get() {
  3507. return this._interaction._proxy;
  3508. }
  3509. }]);
  3510. return BaseEvent;
  3511. }();
  3512. _$BaseEvent_13.BaseEvent = BaseEvent;
  3513. var ___default_13 = BaseEvent;
  3514. _$BaseEvent_13["default"] = ___default_13;
  3515. var _$InteractEvent_15 = {};
  3516. "use strict";
  3517. Object.defineProperty(_$InteractEvent_15, "__esModule", {
  3518. value: true
  3519. });
  3520. _$InteractEvent_15["default"] = _$InteractEvent_15.InteractEvent = _$InteractEvent_15.EventPhase = void 0;
  3521. var ___extend_15 = ___interopRequireDefault_15(_$extend_52);
  3522. var ___getOriginXY_15 = ___interopRequireDefault_15(_$getOriginXY_53);
  3523. var ___hypot_15 = ___interopRequireDefault_15(_$hypot_54);
  3524. var _BaseEvent2 = ___interopRequireDefault_15(_$BaseEvent_13);
  3525. var _defaultOptions = ___interopRequireDefault_15(_$defaultOptions_20);
  3526. function ___interopRequireDefault_15(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  3527. function ___typeof_15(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_15 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_15 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_15(obj); }
  3528. function ___classCallCheck_15(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3529. function ___defineProperties_15(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  3530. function ___createClass_15(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_15(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_15(Constructor, staticProps); return Constructor; }
  3531. function _possibleConstructorReturn(self, call) { if (call && (___typeof_15(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
  3532. function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
  3533. function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  3534. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
  3535. function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
  3536. var __EventPhase_15;
  3537. _$InteractEvent_15.EventPhase = __EventPhase_15;
  3538. (function (EventPhase) {
  3539. EventPhase["Start"] = "start";
  3540. EventPhase["Move"] = "move";
  3541. EventPhase["End"] = "end";
  3542. EventPhase["_NONE"] = "";
  3543. })(__EventPhase_15 || (_$InteractEvent_15.EventPhase = __EventPhase_15 = {}));
  3544. var InteractEvent =
  3545. /*#__PURE__*/
  3546. function (_BaseEvent) {
  3547. _inherits(InteractEvent, _BaseEvent);
  3548. /** */
  3549. function InteractEvent(interaction, event, actionName, phase, element, related, preEnd, type) {
  3550. var _this;
  3551. ___classCallCheck_15(this, InteractEvent);
  3552. _this = _possibleConstructorReturn(this, _getPrototypeOf(InteractEvent).call(this, interaction));
  3553. element = element || interaction.element;
  3554. var target = interaction.interactable; // FIXME: add deltaSource to defaults
  3555. var deltaSource = (target && target.options || _defaultOptions["default"]).deltaSource;
  3556. var origin = (0, ___getOriginXY_15["default"])(target, element, actionName);
  3557. var starting = phase === 'start';
  3558. var ending = phase === 'end';
  3559. var prevEvent = starting ? _assertThisInitialized(_this) : interaction.prevEvent;
  3560. var coords = starting ? interaction.coords.start : ending ? {
  3561. page: prevEvent.page,
  3562. client: prevEvent.client,
  3563. timeStamp: interaction.coords.cur.timeStamp
  3564. } : interaction.coords.cur;
  3565. _this.page = (0, ___extend_15["default"])({}, coords.page);
  3566. _this.client = (0, ___extend_15["default"])({}, coords.client);
  3567. _this.rect = (0, ___extend_15["default"])({}, interaction.rect);
  3568. _this.timeStamp = coords.timeStamp;
  3569. if (!ending) {
  3570. _this.page.x -= origin.x;
  3571. _this.page.y -= origin.y;
  3572. _this.client.x -= origin.x;
  3573. _this.client.y -= origin.y;
  3574. }
  3575. _this.ctrlKey = event.ctrlKey;
  3576. _this.altKey = event.altKey;
  3577. _this.shiftKey = event.shiftKey;
  3578. _this.metaKey = event.metaKey;
  3579. _this.button = event.button;
  3580. _this.buttons = event.buttons;
  3581. _this.target = element;
  3582. _this.currentTarget = element;
  3583. _this.relatedTarget = related || null;
  3584. _this.preEnd = preEnd;
  3585. _this.type = type || actionName + (phase || '');
  3586. _this.interactable = target;
  3587. _this.t0 = starting ? interaction.pointers[interaction.pointers.length - 1].downTime : prevEvent.t0;
  3588. _this.x0 = interaction.coords.start.page.x - origin.x;
  3589. _this.y0 = interaction.coords.start.page.y - origin.y;
  3590. _this.clientX0 = interaction.coords.start.client.x - origin.x;
  3591. _this.clientY0 = interaction.coords.start.client.y - origin.y;
  3592. if (starting || ending) {
  3593. _this.delta = {
  3594. x: 0,
  3595. y: 0
  3596. };
  3597. } else {
  3598. _this.delta = {
  3599. x: _this[deltaSource].x - prevEvent[deltaSource].x,
  3600. y: _this[deltaSource].y - prevEvent[deltaSource].y
  3601. };
  3602. }
  3603. _this.dt = interaction.coords.delta.timeStamp;
  3604. _this.duration = _this.timeStamp - _this.t0; // velocity and speed in pixels per second
  3605. _this.velocity = (0, ___extend_15["default"])({}, interaction.coords.velocity[deltaSource]);
  3606. _this.speed = (0, ___hypot_15["default"])(_this.velocity.x, _this.velocity.y);
  3607. _this.swipe = ending || phase === 'inertiastart' ? _this.getSwipe() : null;
  3608. return _this;
  3609. }
  3610. ___createClass_15(InteractEvent, [{
  3611. key: "getSwipe",
  3612. value: function getSwipe() {
  3613. var interaction = this._interaction;
  3614. if (interaction.prevEvent.speed < 600 || this.timeStamp - interaction.prevEvent.timeStamp > 150) {
  3615. return null;
  3616. }
  3617. var angle = 180 * Math.atan2(interaction.prevEvent.velocityY, interaction.prevEvent.velocityX) / Math.PI;
  3618. var overlap = 22.5;
  3619. if (angle < 0) {
  3620. angle += 360;
  3621. }
  3622. var left = 135 - overlap <= angle && angle < 225 + overlap;
  3623. var up = 225 - overlap <= angle && angle < 315 + overlap;
  3624. var right = !left && (315 - overlap <= angle || angle < 45 + overlap);
  3625. var down = !up && 45 - overlap <= angle && angle < 135 + overlap;
  3626. return {
  3627. up: up,
  3628. down: down,
  3629. left: left,
  3630. right: right,
  3631. angle: angle,
  3632. speed: interaction.prevEvent.speed,
  3633. velocity: {
  3634. x: interaction.prevEvent.velocityX,
  3635. y: interaction.prevEvent.velocityY
  3636. }
  3637. };
  3638. }
  3639. }, {
  3640. key: "preventDefault",
  3641. value: function preventDefault() {}
  3642. /**
  3643. * Don't call listeners on the remaining targets
  3644. */
  3645. }, {
  3646. key: "stopImmediatePropagation",
  3647. value: function stopImmediatePropagation() {
  3648. this.immediatePropagationStopped = this.propagationStopped = true;
  3649. }
  3650. /**
  3651. * Don't call any other listeners (even on the current target)
  3652. */
  3653. }, {
  3654. key: "stopPropagation",
  3655. value: function stopPropagation() {
  3656. this.propagationStopped = true;
  3657. }
  3658. }, {
  3659. key: "pageX",
  3660. get: function get() {
  3661. return this.page.x;
  3662. },
  3663. set: function set(value) {
  3664. this.page.x = value;
  3665. }
  3666. }, {
  3667. key: "pageY",
  3668. get: function get() {
  3669. return this.page.y;
  3670. },
  3671. set: function set(value) {
  3672. this.page.y = value;
  3673. }
  3674. }, {
  3675. key: "clientX",
  3676. get: function get() {
  3677. return this.client.x;
  3678. },
  3679. set: function set(value) {
  3680. this.client.x = value;
  3681. }
  3682. }, {
  3683. key: "clientY",
  3684. get: function get() {
  3685. return this.client.y;
  3686. },
  3687. set: function set(value) {
  3688. this.client.y = value;
  3689. }
  3690. }, {
  3691. key: "dx",
  3692. get: function get() {
  3693. return this.delta.x;
  3694. },
  3695. set: function set(value) {
  3696. this.delta.x = value;
  3697. }
  3698. }, {
  3699. key: "dy",
  3700. get: function get() {
  3701. return this.delta.y;
  3702. },
  3703. set: function set(value) {
  3704. this.delta.y = value;
  3705. }
  3706. }, {
  3707. key: "velocityX",
  3708. get: function get() {
  3709. return this.velocity.x;
  3710. },
  3711. set: function set(value) {
  3712. this.velocity.x = value;
  3713. }
  3714. }, {
  3715. key: "velocityY",
  3716. get: function get() {
  3717. return this.velocity.y;
  3718. },
  3719. set: function set(value) {
  3720. this.velocity.y = value;
  3721. }
  3722. }]);
  3723. return InteractEvent;
  3724. }(_BaseEvent2["default"]);
  3725. _$InteractEvent_15.InteractEvent = InteractEvent;
  3726. var ___default_15 = InteractEvent;
  3727. _$InteractEvent_15["default"] = ___default_15;
  3728. var _$PointerInfo_19 = {};
  3729. "use strict";
  3730. Object.defineProperty(_$PointerInfo_19, "__esModule", {
  3731. value: true
  3732. });
  3733. _$PointerInfo_19["default"] = _$PointerInfo_19.PointerInfo = void 0;
  3734. function ___classCallCheck_19(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3735. var PointerInfo = function PointerInfo(id, pointer, event, downTime, downTarget) {
  3736. ___classCallCheck_19(this, PointerInfo);
  3737. this.id = id;
  3738. this.pointer = pointer;
  3739. this.event = event;
  3740. this.downTime = downTime;
  3741. this.downTarget = downTarget;
  3742. };
  3743. _$PointerInfo_19.PointerInfo = PointerInfo;
  3744. var ___default_19 = PointerInfo;
  3745. _$PointerInfo_19["default"] = ___default_19;
  3746. var _$interactionFinder_22 = {};
  3747. "use strict";
  3748. Object.defineProperty(_$interactionFinder_22, "__esModule", {
  3749. value: true
  3750. });
  3751. _$interactionFinder_22["default"] = void 0;
  3752. var __dom_22 = ___interopRequireWildcard_22(_$domUtils_50);
  3753. function ___interopRequireWildcard_22(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  3754. var finder = {
  3755. methodOrder: ['simulationResume', 'mouseOrPen', 'hasPointer', 'idle'],
  3756. search: function search(details) {
  3757. for (var _i = 0; _i < finder.methodOrder.length; _i++) {
  3758. var _ref;
  3759. _ref = finder.methodOrder[_i];
  3760. var method = _ref;
  3761. var interaction = finder[method](details);
  3762. if (interaction) {
  3763. return interaction;
  3764. }
  3765. }
  3766. },
  3767. // try to resume simulation with a new pointer
  3768. simulationResume: function simulationResume(_ref2) {
  3769. var pointerType = _ref2.pointerType,
  3770. eventType = _ref2.eventType,
  3771. eventTarget = _ref2.eventTarget,
  3772. scope = _ref2.scope;
  3773. if (!/down|start/i.test(eventType)) {
  3774. return null;
  3775. }
  3776. for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) {
  3777. var _ref3;
  3778. _ref3 = scope.interactions.list[_i2];
  3779. var interaction = _ref3;
  3780. var element = eventTarget;
  3781. if (interaction.simulation && interaction.simulation.allowResume && interaction.pointerType === pointerType) {
  3782. while (element) {
  3783. // if the element is the interaction element
  3784. if (element === interaction.element) {
  3785. return interaction;
  3786. }
  3787. element = __dom_22.parentNode(element);
  3788. }
  3789. }
  3790. }
  3791. return null;
  3792. },
  3793. // if it's a mouse or pen interaction
  3794. mouseOrPen: function mouseOrPen(_ref4) {
  3795. var pointerId = _ref4.pointerId,
  3796. pointerType = _ref4.pointerType,
  3797. eventType = _ref4.eventType,
  3798. scope = _ref4.scope;
  3799. if (pointerType !== 'mouse' && pointerType !== 'pen') {
  3800. return null;
  3801. }
  3802. var firstNonActive;
  3803. for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) {
  3804. var _ref5;
  3805. _ref5 = scope.interactions.list[_i3];
  3806. var interaction = _ref5;
  3807. if (interaction.pointerType === pointerType) {
  3808. // if it's a down event, skip interactions with running simulations
  3809. if (interaction.simulation && !hasPointerId(interaction, pointerId)) {
  3810. continue;
  3811. } // if the interaction is active, return it immediately
  3812. if (interaction.interacting()) {
  3813. return interaction;
  3814. } // otherwise save it and look for another active interaction
  3815. else if (!firstNonActive) {
  3816. firstNonActive = interaction;
  3817. }
  3818. }
  3819. } // if no active mouse interaction was found use the first inactive mouse
  3820. // interaction
  3821. if (firstNonActive) {
  3822. return firstNonActive;
  3823. } // find any mouse or pen interaction.
  3824. // ignore the interaction if the eventType is a *down, and a simulation
  3825. // is active
  3826. for (var _i4 = 0; _i4 < scope.interactions.list.length; _i4++) {
  3827. var _ref6;
  3828. _ref6 = scope.interactions.list[_i4];
  3829. var _interaction = _ref6;
  3830. if (_interaction.pointerType === pointerType && !(/down/i.test(eventType) && _interaction.simulation)) {
  3831. return _interaction;
  3832. }
  3833. }
  3834. return null;
  3835. },
  3836. // get interaction that has this pointer
  3837. hasPointer: function hasPointer(_ref7) {
  3838. var pointerId = _ref7.pointerId,
  3839. scope = _ref7.scope;
  3840. for (var _i5 = 0; _i5 < scope.interactions.list.length; _i5++) {
  3841. var _ref8;
  3842. _ref8 = scope.interactions.list[_i5];
  3843. var interaction = _ref8;
  3844. if (hasPointerId(interaction, pointerId)) {
  3845. return interaction;
  3846. }
  3847. }
  3848. return null;
  3849. },
  3850. // get first idle interaction with a matching pointerType
  3851. idle: function idle(_ref9) {
  3852. var pointerType = _ref9.pointerType,
  3853. scope = _ref9.scope;
  3854. for (var _i6 = 0; _i6 < scope.interactions.list.length; _i6++) {
  3855. var _ref10;
  3856. _ref10 = scope.interactions.list[_i6];
  3857. var interaction = _ref10;
  3858. // if there's already a pointer held down
  3859. if (interaction.pointers.length === 1) {
  3860. var target = interaction.interactable; // don't add this pointer if there is a target interactable and it
  3861. // isn't gesturable
  3862. if (target && !target.options.gesture.enabled) {
  3863. continue;
  3864. }
  3865. } // maximum of 2 pointers per interaction
  3866. else if (interaction.pointers.length >= 2) {
  3867. continue;
  3868. }
  3869. if (!interaction.interacting() && pointerType === interaction.pointerType) {
  3870. return interaction;
  3871. }
  3872. }
  3873. return null;
  3874. }
  3875. };
  3876. function hasPointerId(interaction, pointerId) {
  3877. return interaction.pointers.some(function (_ref11) {
  3878. var id = _ref11.id;
  3879. return id === pointerId;
  3880. });
  3881. }
  3882. var ___default_22 = finder;
  3883. _$interactionFinder_22["default"] = ___default_22;
  3884. var _$drag_1 = {};
  3885. "use strict";
  3886. Object.defineProperty(_$drag_1, "__esModule", {
  3887. value: true
  3888. });
  3889. _$drag_1["default"] = void 0;
  3890. var ___scope_1 = _$scope_24({});
  3891. var __arr_1 = ___interopRequireWildcard_1(_$arr_46);
  3892. var __is_1 = ___interopRequireWildcard_1(_$is_56);
  3893. function ___interopRequireWildcard_1(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  3894. ___scope_1.ActionName.Drag = 'drag';
  3895. function __install_1(scope) {
  3896. var actions = scope.actions,
  3897. Interactable = scope.Interactable,
  3898. interactions = scope.interactions,
  3899. defaults = scope.defaults;
  3900. interactions.signals.on('before-action-move', beforeMove);
  3901. interactions.signals.on('action-resume', beforeMove); // dragmove
  3902. interactions.signals.on('action-move', move);
  3903. Interactable.prototype.draggable = drag.draggable;
  3904. actions[___scope_1.ActionName.Drag] = drag;
  3905. actions.names.push(___scope_1.ActionName.Drag);
  3906. __arr_1.merge(actions.eventTypes, ['dragstart', 'dragmove', 'draginertiastart', 'dragresume', 'dragend']);
  3907. actions.methodDict.drag = 'draggable';
  3908. defaults.actions.drag = drag.defaults;
  3909. }
  3910. function beforeMove(_ref) {
  3911. var interaction = _ref.interaction;
  3912. if (interaction.prepared.name !== 'drag') {
  3913. return;
  3914. }
  3915. var axis = interaction.prepared.axis;
  3916. if (axis === 'x') {
  3917. interaction.coords.cur.page.y = interaction.coords.start.page.y;
  3918. interaction.coords.cur.client.y = interaction.coords.start.client.y;
  3919. interaction.coords.velocity.client.y = 0;
  3920. interaction.coords.velocity.page.y = 0;
  3921. } else if (axis === 'y') {
  3922. interaction.coords.cur.page.x = interaction.coords.start.page.x;
  3923. interaction.coords.cur.client.x = interaction.coords.start.client.x;
  3924. interaction.coords.velocity.client.x = 0;
  3925. interaction.coords.velocity.page.x = 0;
  3926. }
  3927. }
  3928. function move(_ref2) {
  3929. var iEvent = _ref2.iEvent,
  3930. interaction = _ref2.interaction;
  3931. if (interaction.prepared.name !== 'drag') {
  3932. return;
  3933. }
  3934. var axis = interaction.prepared.axis;
  3935. if (axis === 'x' || axis === 'y') {
  3936. var opposite = axis === 'x' ? 'y' : 'x';
  3937. iEvent.page[opposite] = interaction.coords.start.page[opposite];
  3938. iEvent.client[opposite] = interaction.coords.start.client[opposite];
  3939. iEvent.delta[opposite] = 0;
  3940. }
  3941. }
  3942. /**
  3943. * ```js
  3944. * interact(element).draggable({
  3945. * onstart: function (event) {},
  3946. * onmove : function (event) {},
  3947. * onend : function (event) {},
  3948. *
  3949. * // the axis in which the first movement must be
  3950. * // for the drag sequence to start
  3951. * // 'xy' by default - any direction
  3952. * startAxis: 'x' || 'y' || 'xy',
  3953. *
  3954. * // 'xy' by default - don't restrict to one axis (move in any direction)
  3955. * // 'x' or 'y' to restrict movement to either axis
  3956. * // 'start' to restrict movement to the axis the drag started in
  3957. * lockAxis: 'x' || 'y' || 'xy' || 'start',
  3958. *
  3959. * // max number of drags that can happen concurrently
  3960. * // with elements of this Interactable. Infinity by default
  3961. * max: Infinity,
  3962. *
  3963. * // max number of drags that can target the same element+Interactable
  3964. * // 1 by default
  3965. * maxPerElement: 2
  3966. * })
  3967. *
  3968. * var isDraggable = interact('element').draggable(); // true
  3969. * ```
  3970. *
  3971. * Get or set whether drag actions can be performed on the target
  3972. *
  3973. * @alias Interactable.prototype.draggable
  3974. *
  3975. * @param {boolean | object} [options] true/false or An object with event
  3976. * listeners to be fired on drag events (object makes the Interactable
  3977. * draggable)
  3978. * @return {boolean | Interactable} boolean indicating if this can be the
  3979. * target of drag events, or this Interctable
  3980. */
  3981. var draggable = function draggable(options) {
  3982. if (__is_1.object(options)) {
  3983. this.options.drag.enabled = options.enabled !== false;
  3984. this.setPerAction('drag', options);
  3985. this.setOnEvents('drag', options);
  3986. if (/^(xy|x|y|start)$/.test(options.lockAxis)) {
  3987. this.options.drag.lockAxis = options.lockAxis;
  3988. }
  3989. if (/^(xy|x|y)$/.test(options.startAxis)) {
  3990. this.options.drag.startAxis = options.startAxis;
  3991. }
  3992. return this;
  3993. }
  3994. if (__is_1.bool(options)) {
  3995. this.options.drag.enabled = options;
  3996. return this;
  3997. }
  3998. return this.options.drag;
  3999. };
  4000. var drag = {
  4001. id: 'actions/drag',
  4002. install: __install_1,
  4003. draggable: draggable,
  4004. beforeMove: beforeMove,
  4005. move: move,
  4006. defaults: {
  4007. startAxis: 'xy',
  4008. lockAxis: 'xy'
  4009. },
  4010. checker: function checker(_pointer, _event, interactable) {
  4011. var dragOptions = interactable.options.drag;
  4012. return dragOptions.enabled ? {
  4013. name: 'drag',
  4014. axis: dragOptions.lockAxis === 'start' ? dragOptions.startAxis : dragOptions.lockAxis
  4015. } : null;
  4016. },
  4017. getCursor: function getCursor() {
  4018. return 'move';
  4019. }
  4020. };
  4021. var ___default_1 = drag;
  4022. _$drag_1["default"] = ___default_1;
  4023. var _$DropEvent_2 = {};
  4024. "use strict";
  4025. Object.defineProperty(_$DropEvent_2, "__esModule", {
  4026. value: true
  4027. });
  4028. _$DropEvent_2["default"] = void 0;
  4029. var ___BaseEvent2_2 = ___interopRequireDefault_2(_$BaseEvent_13);
  4030. var __arr_2 = ___interopRequireWildcard_2(_$arr_46);
  4031. function ___interopRequireWildcard_2(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  4032. function ___interopRequireDefault_2(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4033. function ___typeof_2(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_2 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_2 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_2(obj); }
  4034. function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
  4035. function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  4036. function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  4037. function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  4038. function ___classCallCheck_2(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4039. function ___defineProperties_2(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  4040. function ___createClass_2(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_2(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_2(Constructor, staticProps); return Constructor; }
  4041. function ___possibleConstructorReturn_2(self, call) { if (call && (___typeof_2(call) === "object" || typeof call === "function")) { return call; } return ___assertThisInitialized_2(self); }
  4042. function ___assertThisInitialized_2(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  4043. function ___getPrototypeOf_2(o) { ___getPrototypeOf_2 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ___getPrototypeOf_2(o); }
  4044. function ___inherits_2(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ___setPrototypeOf_2(subClass, superClass); }
  4045. function ___setPrototypeOf_2(o, p) { ___setPrototypeOf_2 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_2(o, p); }
  4046. var DropEvent =
  4047. /*#__PURE__*/
  4048. function (_BaseEvent) {
  4049. ___inherits_2(DropEvent, _BaseEvent);
  4050. /**
  4051. * Class of events fired on dropzones during drags with acceptable targets.
  4052. */
  4053. function DropEvent(dropState, dragEvent, type) {
  4054. var _this;
  4055. ___classCallCheck_2(this, DropEvent);
  4056. _this = ___possibleConstructorReturn_2(this, ___getPrototypeOf_2(DropEvent).call(this, dragEvent._interaction));
  4057. _this.propagationStopped = false;
  4058. _this.immediatePropagationStopped = false;
  4059. var _ref = type === 'dragleave' ? dropState.prev : dropState.cur,
  4060. element = _ref.element,
  4061. dropzone = _ref.dropzone;
  4062. _this.type = type;
  4063. _this.target = element;
  4064. _this.currentTarget = element;
  4065. _this.dropzone = dropzone;
  4066. _this.dragEvent = dragEvent;
  4067. _this.relatedTarget = dragEvent.target;
  4068. _this.draggable = dragEvent.interactable;
  4069. _this.timeStamp = dragEvent.timeStamp;
  4070. return _this;
  4071. }
  4072. /**
  4073. * If this is a `dropactivate` event, the dropzone element will be
  4074. * deactivated.
  4075. *
  4076. * If this is a `dragmove` or `dragenter`, a `dragleave` will be fired on the
  4077. * dropzone element and more.
  4078. */
  4079. ___createClass_2(DropEvent, [{
  4080. key: "reject",
  4081. value: function reject() {
  4082. var _this2 = this;
  4083. var dropState = this._interaction.dropState;
  4084. if (this.type !== 'dropactivate' && (!this.dropzone || dropState.cur.dropzone !== this.dropzone || dropState.cur.element !== this.target)) {
  4085. return;
  4086. }
  4087. dropState.prev.dropzone = this.dropzone;
  4088. dropState.prev.element = this.target;
  4089. dropState.rejected = true;
  4090. dropState.events.enter = null;
  4091. this.stopImmediatePropagation();
  4092. if (this.type === 'dropactivate') {
  4093. var activeDrops = dropState.activeDrops;
  4094. var index = __arr_2.findIndex(activeDrops, function (_ref2) {
  4095. var dropzone = _ref2.dropzone,
  4096. element = _ref2.element;
  4097. return dropzone === _this2.dropzone && element === _this2.target;
  4098. });
  4099. dropState.activeDrops = [].concat(_toConsumableArray(activeDrops.slice(0, index)), _toConsumableArray(activeDrops.slice(index + 1)));
  4100. var deactivateEvent = new DropEvent(dropState, this.dragEvent, 'dropdeactivate');
  4101. deactivateEvent.dropzone = this.dropzone;
  4102. deactivateEvent.target = this.target;
  4103. this.dropzone.fire(deactivateEvent);
  4104. } else {
  4105. this.dropzone.fire(new DropEvent(dropState, this.dragEvent, 'dragleave'));
  4106. }
  4107. }
  4108. }, {
  4109. key: "preventDefault",
  4110. value: function preventDefault() {}
  4111. }, {
  4112. key: "stopPropagation",
  4113. value: function stopPropagation() {
  4114. this.propagationStopped = true;
  4115. }
  4116. }, {
  4117. key: "stopImmediatePropagation",
  4118. value: function stopImmediatePropagation() {
  4119. this.immediatePropagationStopped = this.propagationStopped = true;
  4120. }
  4121. }]);
  4122. return DropEvent;
  4123. }(___BaseEvent2_2["default"]);
  4124. var ___default_2 = DropEvent;
  4125. _$DropEvent_2["default"] = ___default_2;
  4126. var _$drop_3 = {};
  4127. "use strict";
  4128. Object.defineProperty(_$drop_3, "__esModule", {
  4129. value: true
  4130. });
  4131. _$drop_3["default"] = void 0;
  4132. var __utils_3 = ___interopRequireWildcard_3(_$utils_55);
  4133. var _drag = ___interopRequireDefault_3(_$drag_1);
  4134. var _DropEvent = ___interopRequireDefault_3(_$DropEvent_2);
  4135. function ___interopRequireDefault_3(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4136. function ___interopRequireWildcard_3(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  4137. function __install_3(scope) {
  4138. var actions = scope.actions,
  4139. interact = scope.interact,
  4140. Interactable = scope.Interactable,
  4141. interactions = scope.interactions,
  4142. defaults = scope.defaults;
  4143. scope.usePlugin(_drag["default"]);
  4144. interactions.signals.on('before-action-start', function (_ref) {
  4145. var interaction = _ref.interaction;
  4146. if (interaction.prepared.name !== 'drag') {
  4147. return;
  4148. }
  4149. interaction.dropState = {
  4150. cur: {
  4151. dropzone: null,
  4152. element: null
  4153. },
  4154. prev: {
  4155. dropzone: null,
  4156. element: null
  4157. },
  4158. rejected: null,
  4159. events: null,
  4160. activeDrops: null
  4161. };
  4162. });
  4163. interactions.signals.on('after-action-start', function (_ref2) {
  4164. var interaction = _ref2.interaction,
  4165. event = _ref2.event,
  4166. dragEvent = _ref2.iEvent;
  4167. if (interaction.prepared.name !== 'drag') {
  4168. return;
  4169. }
  4170. var dropState = interaction.dropState; // reset active dropzones
  4171. dropState.activeDrops = null;
  4172. dropState.events = null;
  4173. dropState.activeDrops = getActiveDrops(scope, interaction.element);
  4174. dropState.events = getDropEvents(interaction, event, dragEvent);
  4175. if (dropState.events.activate) {
  4176. fireActivationEvents(dropState.activeDrops, dropState.events.activate);
  4177. }
  4178. }); // FIXME proper signal types
  4179. interactions.signals.on('action-move', function (arg) {
  4180. return onEventCreated(arg, scope);
  4181. });
  4182. interactions.signals.on('action-end', function (arg) {
  4183. return onEventCreated(arg, scope);
  4184. });
  4185. interactions.signals.on('after-action-move', function (_ref3) {
  4186. var interaction = _ref3.interaction;
  4187. if (interaction.prepared.name !== 'drag') {
  4188. return;
  4189. }
  4190. fireDropEvents(interaction, interaction.dropState.events);
  4191. interaction.dropState.events = {};
  4192. });
  4193. interactions.signals.on('after-action-end', function (_ref4) {
  4194. var interaction = _ref4.interaction;
  4195. if (interaction.prepared.name !== 'drag') {
  4196. return;
  4197. }
  4198. fireDropEvents(interaction, interaction.dropState.events);
  4199. });
  4200. interactions.signals.on('stop', function (_ref5) {
  4201. var interaction = _ref5.interaction;
  4202. if (interaction.prepared.name !== 'drag') {
  4203. return;
  4204. }
  4205. var dropState = interaction.dropState;
  4206. if (dropState) {
  4207. dropState.activeDrops = null;
  4208. dropState.events = null;
  4209. dropState.cur.dropzone = null;
  4210. dropState.cur.element = null;
  4211. dropState.prev.dropzone = null;
  4212. dropState.prev.element = null;
  4213. dropState.rejected = false;
  4214. }
  4215. });
  4216. /**
  4217. *
  4218. * ```js
  4219. * interact('.drop').dropzone({
  4220. * accept: '.can-drop' || document.getElementById('single-drop'),
  4221. * overlap: 'pointer' || 'center' || zeroToOne
  4222. * }
  4223. * ```
  4224. *
  4225. * Returns or sets whether draggables can be dropped onto this target to
  4226. * trigger drop events
  4227. *
  4228. * Dropzones can receive the following events:
  4229. * - `dropactivate` and `dropdeactivate` when an acceptable drag starts and ends
  4230. * - `dragenter` and `dragleave` when a draggable enters and leaves the dropzone
  4231. * - `dragmove` when a draggable that has entered the dropzone is moved
  4232. * - `drop` when a draggable is dropped into this dropzone
  4233. *
  4234. * Use the `accept` option to allow only elements that match the given CSS
  4235. * selector or element. The value can be:
  4236. *
  4237. * - **an Element** - only that element can be dropped into this dropzone.
  4238. * - **a string**, - the element being dragged must match it as a CSS selector.
  4239. * - **`null`** - accept options is cleared - it accepts any element.
  4240. *
  4241. * Use the `overlap` option to set how drops are checked for. The allowed
  4242. * values are:
  4243. *
  4244. * - `'pointer'`, the pointer must be over the dropzone (default)
  4245. * - `'center'`, the draggable element's center must be over the dropzone
  4246. * - a number from 0-1 which is the `(intersection area) / (draggable area)`.
  4247. * e.g. `0.5` for drop to happen when half of the area of the draggable is
  4248. * over the dropzone
  4249. *
  4250. * Use the `checker` option to specify a function to check if a dragged element
  4251. * is over this Interactable.
  4252. *
  4253. * @param {boolean | object | null} [options] The new options to be set.
  4254. * @return {boolean | Interactable} The current setting or this Interactable
  4255. */
  4256. Interactable.prototype.dropzone = function (options) {
  4257. return dropzoneMethod(this, options);
  4258. };
  4259. /**
  4260. * ```js
  4261. * interact(target)
  4262. * .dropChecker(function(dragEvent, // related dragmove or dragend event
  4263. * event, // TouchEvent/PointerEvent/MouseEvent
  4264. * dropped, // bool result of the default checker
  4265. * dropzone, // dropzone Interactable
  4266. * dropElement, // dropzone elemnt
  4267. * draggable, // draggable Interactable
  4268. * draggableElement) {// draggable element
  4269. *
  4270. * return dropped && event.target.hasAttribute('allow-drop')
  4271. * }
  4272. * ```
  4273. */
  4274. Interactable.prototype.dropCheck = function (dragEvent, event, draggable, draggableElement, dropElement, rect) {
  4275. return dropCheckMethod(this, dragEvent, event, draggable, draggableElement, dropElement, rect);
  4276. };
  4277. /**
  4278. * Returns or sets whether the dimensions of dropzone elements are calculated
  4279. * on every dragmove or only on dragstart for the default dropChecker
  4280. *
  4281. * @param {boolean} [newValue] True to check on each move. False to check only
  4282. * before start
  4283. * @return {boolean | interact} The current setting or interact
  4284. */
  4285. interact.dynamicDrop = function (newValue) {
  4286. if (__utils_3.is.bool(newValue)) {
  4287. // if (dragging && scope.dynamicDrop !== newValue && !newValue) {
  4288. // calcRects(dropzones)
  4289. // }
  4290. scope.dynamicDrop = newValue;
  4291. return interact;
  4292. }
  4293. return scope.dynamicDrop;
  4294. };
  4295. __utils_3.arr.merge(actions.eventTypes, ['dragenter', 'dragleave', 'dropactivate', 'dropdeactivate', 'dropmove', 'drop']);
  4296. actions.methodDict.drop = 'dropzone';
  4297. scope.dynamicDrop = false;
  4298. defaults.actions.drop = drop.defaults;
  4299. }
  4300. function collectDrops(_ref6, draggableElement) {
  4301. var interactables = _ref6.interactables;
  4302. var drops = []; // collect all dropzones and their elements which qualify for a drop
  4303. for (var _i = 0; _i < interactables.list.length; _i++) {
  4304. var _ref7;
  4305. _ref7 = interactables.list[_i];
  4306. var dropzone = _ref7;
  4307. if (!dropzone.options.drop.enabled) {
  4308. continue;
  4309. }
  4310. var accept = dropzone.options.drop.accept; // test the draggable draggableElement against the dropzone's accept setting
  4311. if (__utils_3.is.element(accept) && accept !== draggableElement || __utils_3.is.string(accept) && !__utils_3.dom.matchesSelector(draggableElement, accept) || __utils_3.is.func(accept) && !accept({
  4312. dropzone: dropzone,
  4313. draggableElement: draggableElement
  4314. })) {
  4315. continue;
  4316. } // query for new elements if necessary
  4317. var dropElements = __utils_3.is.string(dropzone.target) ? dropzone._context.querySelectorAll(dropzone.target) : __utils_3.is.array(dropzone.target) ? dropzone.target : [dropzone.target];
  4318. for (var _i2 = 0; _i2 < dropElements.length; _i2++) {
  4319. var _ref8;
  4320. _ref8 = dropElements[_i2];
  4321. var dropzoneElement = _ref8;
  4322. if (dropzoneElement !== draggableElement) {
  4323. drops.push({
  4324. dropzone: dropzone,
  4325. element: dropzoneElement
  4326. });
  4327. }
  4328. }
  4329. }
  4330. return drops;
  4331. }
  4332. function fireActivationEvents(activeDrops, event) {
  4333. // loop through all active dropzones and trigger event
  4334. for (var _i3 = 0; _i3 < activeDrops.length; _i3++) {
  4335. var _ref9;
  4336. _ref9 = activeDrops[_i3];
  4337. var _ref10 = _ref9,
  4338. dropzone = _ref10.dropzone,
  4339. element = _ref10.element;
  4340. event.dropzone = dropzone; // set current element as event target
  4341. event.target = element;
  4342. dropzone.fire(event);
  4343. event.propagationStopped = event.immediatePropagationStopped = false;
  4344. }
  4345. } // return a new array of possible drops. getActiveDrops should always be
  4346. // called when a drag has just started or a drag event happens while
  4347. // dynamicDrop is true
  4348. function getActiveDrops(scope, dragElement) {
  4349. // get dropzones and their elements that could receive the draggable
  4350. var activeDrops = collectDrops(scope, dragElement);
  4351. for (var _i4 = 0; _i4 < activeDrops.length; _i4++) {
  4352. var _ref11;
  4353. _ref11 = activeDrops[_i4];
  4354. var activeDrop = _ref11;
  4355. activeDrop.rect = activeDrop.dropzone.getRect(activeDrop.element);
  4356. }
  4357. return activeDrops;
  4358. }
  4359. function getDrop(_ref12, dragEvent, pointerEvent) {
  4360. var dropState = _ref12.dropState,
  4361. draggable = _ref12.interactable,
  4362. dragElement = _ref12.element;
  4363. var validDrops = []; // collect all dropzones and their elements which qualify for a drop
  4364. for (var _i5 = 0; _i5 < dropState.activeDrops.length; _i5++) {
  4365. var _ref13;
  4366. _ref13 = dropState.activeDrops[_i5];
  4367. var _ref14 = _ref13,
  4368. dropzone = _ref14.dropzone,
  4369. dropzoneElement = _ref14.element,
  4370. rect = _ref14.rect;
  4371. validDrops.push(dropzone.dropCheck(dragEvent, pointerEvent, draggable, dragElement, dropzoneElement, rect) ? dropzoneElement : null);
  4372. } // get the most appropriate dropzone based on DOM depth and order
  4373. var dropIndex = __utils_3.dom.indexOfDeepestElement(validDrops);
  4374. return dropState.activeDrops[dropIndex] || null;
  4375. }
  4376. function getDropEvents(interaction, _pointerEvent, dragEvent) {
  4377. var dropState = interaction.dropState;
  4378. var dropEvents = {
  4379. enter: null,
  4380. leave: null,
  4381. activate: null,
  4382. deactivate: null,
  4383. move: null,
  4384. drop: null
  4385. };
  4386. if (dragEvent.type === 'dragstart') {
  4387. dropEvents.activate = new _DropEvent["default"](dropState, dragEvent, 'dropactivate');
  4388. dropEvents.activate.target = null;
  4389. dropEvents.activate.dropzone = null;
  4390. }
  4391. if (dragEvent.type === 'dragend') {
  4392. dropEvents.deactivate = new _DropEvent["default"](dropState, dragEvent, 'dropdeactivate');
  4393. dropEvents.deactivate.target = null;
  4394. dropEvents.deactivate.dropzone = null;
  4395. }
  4396. if (dropState.rejected) {
  4397. return dropEvents;
  4398. }
  4399. if (dropState.cur.element !== dropState.prev.element) {
  4400. // if there was a previous dropzone, create a dragleave event
  4401. if (dropState.prev.dropzone) {
  4402. dropEvents.leave = new _DropEvent["default"](dropState, dragEvent, 'dragleave');
  4403. dragEvent.dragLeave = dropEvents.leave.target = dropState.prev.element;
  4404. dragEvent.prevDropzone = dropEvents.leave.dropzone = dropState.prev.dropzone;
  4405. } // if dropzone is not null, create a dragenter event
  4406. if (dropState.cur.dropzone) {
  4407. dropEvents.enter = new _DropEvent["default"](dropState, dragEvent, 'dragenter');
  4408. dragEvent.dragEnter = dropState.cur.element;
  4409. dragEvent.dropzone = dropState.cur.dropzone;
  4410. }
  4411. }
  4412. if (dragEvent.type === 'dragend' && dropState.cur.dropzone) {
  4413. dropEvents.drop = new _DropEvent["default"](dropState, dragEvent, 'drop');
  4414. dragEvent.dropzone = dropState.cur.dropzone;
  4415. dragEvent.relatedTarget = dropState.cur.element;
  4416. }
  4417. if (dragEvent.type === 'dragmove' && dropState.cur.dropzone) {
  4418. dropEvents.move = new _DropEvent["default"](dropState, dragEvent, 'dropmove');
  4419. dropEvents.move.dragmove = dragEvent;
  4420. dragEvent.dropzone = dropState.cur.dropzone;
  4421. }
  4422. return dropEvents;
  4423. }
  4424. function fireDropEvents(interaction, events) {
  4425. var dropState = interaction.dropState;
  4426. var activeDrops = dropState.activeDrops,
  4427. cur = dropState.cur,
  4428. prev = dropState.prev;
  4429. if (events.leave) {
  4430. prev.dropzone.fire(events.leave);
  4431. }
  4432. if (events.move) {
  4433. cur.dropzone.fire(events.move);
  4434. }
  4435. if (events.enter) {
  4436. cur.dropzone.fire(events.enter);
  4437. }
  4438. if (events.drop) {
  4439. cur.dropzone.fire(events.drop);
  4440. }
  4441. if (events.deactivate) {
  4442. fireActivationEvents(activeDrops, events.deactivate);
  4443. }
  4444. dropState.prev.dropzone = cur.dropzone;
  4445. dropState.prev.element = cur.element;
  4446. }
  4447. function onEventCreated(_ref15, scope) {
  4448. var interaction = _ref15.interaction,
  4449. iEvent = _ref15.iEvent,
  4450. event = _ref15.event;
  4451. if (iEvent.type !== 'dragmove' && iEvent.type !== 'dragend') {
  4452. return;
  4453. }
  4454. var dropState = interaction.dropState;
  4455. if (scope.dynamicDrop) {
  4456. dropState.activeDrops = getActiveDrops(scope, interaction.element);
  4457. }
  4458. var dragEvent = iEvent;
  4459. var dropResult = getDrop(interaction, dragEvent, event); // update rejected status
  4460. dropState.rejected = dropState.rejected && !!dropResult && dropResult.dropzone === dropState.cur.dropzone && dropResult.element === dropState.cur.element;
  4461. dropState.cur.dropzone = dropResult && dropResult.dropzone;
  4462. dropState.cur.element = dropResult && dropResult.element;
  4463. dropState.events = getDropEvents(interaction, event, dragEvent);
  4464. }
  4465. function dropzoneMethod(interactable, options) {
  4466. if (__utils_3.is.object(options)) {
  4467. interactable.options.drop.enabled = options.enabled !== false;
  4468. if (options.listeners) {
  4469. var normalized = __utils_3.normalizeListeners(options.listeners); // rename 'drop' to '' as it will be prefixed with 'drop'
  4470. var corrected = Object.keys(normalized).reduce(function (acc, type) {
  4471. var correctedType = /^(enter|leave)/.test(type) ? "drag".concat(type) : /^(activate|deactivate|move)/.test(type) ? "drop".concat(type) : type;
  4472. acc[correctedType] = normalized[type];
  4473. return acc;
  4474. }, {});
  4475. interactable.off(interactable.options.drop.listeners);
  4476. interactable.on(corrected);
  4477. interactable.options.drop.listeners = corrected;
  4478. }
  4479. if (__utils_3.is.func(options.ondrop)) {
  4480. interactable.on('drop', options.ondrop);
  4481. }
  4482. if (__utils_3.is.func(options.ondropactivate)) {
  4483. interactable.on('dropactivate', options.ondropactivate);
  4484. }
  4485. if (__utils_3.is.func(options.ondropdeactivate)) {
  4486. interactable.on('dropdeactivate', options.ondropdeactivate);
  4487. }
  4488. if (__utils_3.is.func(options.ondragenter)) {
  4489. interactable.on('dragenter', options.ondragenter);
  4490. }
  4491. if (__utils_3.is.func(options.ondragleave)) {
  4492. interactable.on('dragleave', options.ondragleave);
  4493. }
  4494. if (__utils_3.is.func(options.ondropmove)) {
  4495. interactable.on('dropmove', options.ondropmove);
  4496. }
  4497. if (/^(pointer|center)$/.test(options.overlap)) {
  4498. interactable.options.drop.overlap = options.overlap;
  4499. } else if (__utils_3.is.number(options.overlap)) {
  4500. interactable.options.drop.overlap = Math.max(Math.min(1, options.overlap), 0);
  4501. }
  4502. if ('accept' in options) {
  4503. interactable.options.drop.accept = options.accept;
  4504. }
  4505. if ('checker' in options) {
  4506. interactable.options.drop.checker = options.checker;
  4507. }
  4508. return interactable;
  4509. }
  4510. if (__utils_3.is.bool(options)) {
  4511. interactable.options.drop.enabled = options;
  4512. return interactable;
  4513. }
  4514. return interactable.options.drop;
  4515. }
  4516. function dropCheckMethod(interactable, dragEvent, event, draggable, draggableElement, dropElement, rect) {
  4517. var dropped = false; // if the dropzone has no rect (eg. display: none)
  4518. // call the custom dropChecker or just return false
  4519. if (!(rect = rect || interactable.getRect(dropElement))) {
  4520. return interactable.options.drop.checker ? interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement) : false;
  4521. }
  4522. var dropOverlap = interactable.options.drop.overlap;
  4523. if (dropOverlap === 'pointer') {
  4524. var origin = __utils_3.getOriginXY(draggable, draggableElement, 'drag');
  4525. var page = __utils_3.pointer.getPageXY(dragEvent);
  4526. page.x += origin.x;
  4527. page.y += origin.y;
  4528. var horizontal = page.x > rect.left && page.x < rect.right;
  4529. var vertical = page.y > rect.top && page.y < rect.bottom;
  4530. dropped = horizontal && vertical;
  4531. }
  4532. var dragRect = draggable.getRect(draggableElement);
  4533. if (dragRect && dropOverlap === 'center') {
  4534. var cx = dragRect.left + dragRect.width / 2;
  4535. var cy = dragRect.top + dragRect.height / 2;
  4536. dropped = cx >= rect.left && cx <= rect.right && cy >= rect.top && cy <= rect.bottom;
  4537. }
  4538. if (dragRect && __utils_3.is.number(dropOverlap)) {
  4539. var overlapArea = Math.max(0, Math.min(rect.right, dragRect.right) - Math.max(rect.left, dragRect.left)) * Math.max(0, Math.min(rect.bottom, dragRect.bottom) - Math.max(rect.top, dragRect.top));
  4540. var overlapRatio = overlapArea / (dragRect.width * dragRect.height);
  4541. dropped = overlapRatio >= dropOverlap;
  4542. }
  4543. if (interactable.options.drop.checker) {
  4544. dropped = interactable.options.drop.checker(dragEvent, event, dropped, interactable, dropElement, draggable, draggableElement);
  4545. }
  4546. return dropped;
  4547. }
  4548. var drop = {
  4549. id: 'actions/drop',
  4550. install: __install_3,
  4551. getActiveDrops: getActiveDrops,
  4552. getDrop: getDrop,
  4553. getDropEvents: getDropEvents,
  4554. fireDropEvents: fireDropEvents,
  4555. defaults: {
  4556. enabled: false,
  4557. accept: null,
  4558. overlap: 'pointer'
  4559. }
  4560. };
  4561. var ___default_3 = drop;
  4562. _$drop_3["default"] = ___default_3;
  4563. var _$gesture_4 = {};
  4564. "use strict";
  4565. Object.defineProperty(_$gesture_4, "__esModule", {
  4566. value: true
  4567. });
  4568. _$gesture_4["default"] = void 0;
  4569. var ___InteractEvent_4 = ___interopRequireDefault_4(_$InteractEvent_15);
  4570. var ___scope_4 = _$scope_24({});
  4571. var __utils_4 = ___interopRequireWildcard_4(_$utils_55);
  4572. function ___interopRequireWildcard_4(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  4573. function ___interopRequireDefault_4(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  4574. ___scope_4.ActionName.Gesture = 'gesture';
  4575. function __install_4(scope) {
  4576. var actions = scope.actions,
  4577. Interactable = scope.Interactable,
  4578. interactions = scope.interactions,
  4579. defaults = scope.defaults;
  4580. /**
  4581. * ```js
  4582. * interact(element).gesturable({
  4583. * onstart: function (event) {},
  4584. * onmove : function (event) {},
  4585. * onend : function (event) {},
  4586. *
  4587. * // limit multiple gestures.
  4588. * // See the explanation in {@link Interactable.draggable} example
  4589. * max: Infinity,
  4590. * maxPerElement: 1,
  4591. * })
  4592. *
  4593. * var isGestureable = interact(element).gesturable()
  4594. * ```
  4595. *
  4596. * Gets or sets whether multitouch gestures can be performed on the target
  4597. *
  4598. * @param {boolean | object} [options] true/false or An object with event
  4599. * listeners to be fired on gesture events (makes the Interactable gesturable)
  4600. * @return {boolean | Interactable} A boolean indicating if this can be the
  4601. * target of gesture events, or this Interactable
  4602. */
  4603. Interactable.prototype.gesturable = function (options) {
  4604. if (__utils_4.is.object(options)) {
  4605. this.options.gesture.enabled = options.enabled !== false;
  4606. this.setPerAction('gesture', options);
  4607. this.setOnEvents('gesture', options);
  4608. return this;
  4609. }
  4610. if (__utils_4.is.bool(options)) {
  4611. this.options.gesture.enabled = options;
  4612. return this;
  4613. }
  4614. return this.options.gesture;
  4615. };
  4616. interactions.signals.on('action-start', updateGestureProps);
  4617. interactions.signals.on('action-move', updateGestureProps);
  4618. interactions.signals.on('action-end', updateGestureProps);
  4619. interactions.signals.on('new', function (_ref) {
  4620. var interaction = _ref.interaction;
  4621. interaction.gesture = {
  4622. angle: 0,
  4623. distance: 0,
  4624. scale: 1,
  4625. startAngle: 0,
  4626. startDistance: 0
  4627. };
  4628. });
  4629. actions[___scope_4.ActionName.Gesture] = gesture;
  4630. actions.names.push(___scope_4.ActionName.Gesture);
  4631. __utils_4.arr.merge(actions.eventTypes, ['gesturestart', 'gesturemove', 'gestureend']);
  4632. actions.methodDict.gesture = 'gesturable';
  4633. defaults.actions.gesture = gesture.defaults;
  4634. }
  4635. var gesture = {
  4636. id: 'actions/gesture',
  4637. install: __install_4,
  4638. defaults: {},
  4639. checker: function checker(_pointer, _event, _interactable, _element, interaction) {
  4640. if (interaction.pointers.length >= 2) {
  4641. return {
  4642. name: 'gesture'
  4643. };
  4644. }
  4645. return null;
  4646. },
  4647. getCursor: function getCursor() {
  4648. return '';
  4649. }
  4650. };
  4651. function updateGestureProps(_ref2) {
  4652. var interaction = _ref2.interaction,
  4653. iEvent = _ref2.iEvent,
  4654. event = _ref2.event,
  4655. phase = _ref2.phase;
  4656. if (interaction.prepared.name !== 'gesture') {
  4657. return;
  4658. }
  4659. var pointers = interaction.pointers.map(function (p) {
  4660. return p.pointer;
  4661. });
  4662. var starting = phase === 'start';
  4663. var ending = phase === 'end';
  4664. var deltaSource = interaction.interactable.options.deltaSource;
  4665. iEvent.touches = [pointers[0], pointers[1]];
  4666. if (starting) {
  4667. iEvent.distance = __utils_4.pointer.touchDistance(pointers, deltaSource);
  4668. iEvent.box = __utils_4.pointer.touchBBox(pointers);
  4669. iEvent.scale = 1;
  4670. iEvent.ds = 0;
  4671. iEvent.angle = __utils_4.pointer.touchAngle(pointers, deltaSource);
  4672. iEvent.da = 0;
  4673. interaction.gesture.startDistance = iEvent.distance;
  4674. interaction.gesture.startAngle = iEvent.angle;
  4675. } else if (ending || event instanceof ___InteractEvent_4["default"]) {
  4676. var prevEvent = interaction.prevEvent;
  4677. iEvent.distance = prevEvent.distance;
  4678. iEvent.box = prevEvent.box;
  4679. iEvent.scale = prevEvent.scale;
  4680. iEvent.ds = 0;
  4681. iEvent.angle = prevEvent.angle;
  4682. iEvent.da = 0;
  4683. } else {
  4684. iEvent.distance = __utils_4.pointer.touchDistance(pointers, deltaSource);
  4685. iEvent.box = __utils_4.pointer.touchBBox(pointers);
  4686. iEvent.scale = iEvent.distance / interaction.gesture.startDistance;
  4687. iEvent.angle = __utils_4.pointer.touchAngle(pointers, deltaSource);
  4688. iEvent.ds = iEvent.scale - interaction.gesture.scale;
  4689. iEvent.da = iEvent.angle - interaction.gesture.angle;
  4690. }
  4691. interaction.gesture.distance = iEvent.distance;
  4692. interaction.gesture.angle = iEvent.angle;
  4693. if (__utils_4.is.number(iEvent.scale) && iEvent.scale !== Infinity && !isNaN(iEvent.scale)) {
  4694. interaction.gesture.scale = iEvent.scale;
  4695. }
  4696. }
  4697. var ___default_4 = gesture;
  4698. _$gesture_4["default"] = ___default_4;
  4699. var _$resize_6 = {};
  4700. "use strict";
  4701. Object.defineProperty(_$resize_6, "__esModule", {
  4702. value: true
  4703. });
  4704. _$resize_6["default"] = void 0;
  4705. var ___scope_6 = _$scope_24({});
  4706. var __utils_6 = ___interopRequireWildcard_6(_$utils_55);
  4707. function ___interopRequireWildcard_6(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  4708. ___scope_6.ActionName.Resize = 'resize';
  4709. function __install_6(scope) {
  4710. var actions = scope.actions,
  4711. browser = scope.browser,
  4712. Interactable = scope.Interactable,
  4713. interactions = scope.interactions,
  4714. defaults = scope.defaults; // Less Precision with touch input
  4715. interactions.signals.on('new', function (interaction) {
  4716. interaction.resizeAxes = 'xy';
  4717. });
  4718. interactions.signals.on('action-start', start);
  4719. interactions.signals.on('action-move', __move_6);
  4720. interactions.signals.on('action-start', updateEventAxes);
  4721. interactions.signals.on('action-move', updateEventAxes);
  4722. resize.cursors = initCursors(browser);
  4723. resize.defaultMargin = browser.supportsTouch || browser.supportsPointerEvent ? 20 : 10;
  4724. /**
  4725. * ```js
  4726. * interact(element).resizable({
  4727. * onstart: function (event) {},
  4728. * onmove : function (event) {},
  4729. * onend : function (event) {},
  4730. *
  4731. * edges: {
  4732. * top : true, // Use pointer coords to check for resize.
  4733. * left : false, // Disable resizing from left edge.
  4734. * bottom: '.resize-s',// Resize if pointer target matches selector
  4735. * right : handleEl // Resize if pointer target is the given Element
  4736. * },
  4737. *
  4738. * // Width and height can be adjusted independently. When `true`, width and
  4739. * // height are adjusted at a 1:1 ratio.
  4740. * square: false,
  4741. *
  4742. * // Width and height can be adjusted independently. When `true`, width and
  4743. * // height maintain the aspect ratio they had when resizing started.
  4744. * preserveAspectRatio: false,
  4745. *
  4746. * // a value of 'none' will limit the resize rect to a minimum of 0x0
  4747. * // 'negate' will allow the rect to have negative width/height
  4748. * // 'reposition' will keep the width/height positive by swapping
  4749. * // the top and bottom edges and/or swapping the left and right edges
  4750. * invert: 'none' || 'negate' || 'reposition'
  4751. *
  4752. * // limit multiple resizes.
  4753. * // See the explanation in the {@link Interactable.draggable} example
  4754. * max: Infinity,
  4755. * maxPerElement: 1,
  4756. * })
  4757. *
  4758. * var isResizeable = interact(element).resizable()
  4759. * ```
  4760. *
  4761. * Gets or sets whether resize actions can be performed on the target
  4762. *
  4763. * @param {boolean | object} [options] true/false or An object with event
  4764. * listeners to be fired on resize events (object makes the Interactable
  4765. * resizable)
  4766. * @return {boolean | Interactable} A boolean indicating if this can be the
  4767. * target of resize elements, or this Interactable
  4768. */
  4769. Interactable.prototype.resizable = function (options) {
  4770. return resizable(this, options, scope);
  4771. };
  4772. actions[___scope_6.ActionName.Resize] = resize;
  4773. actions.names.push(___scope_6.ActionName.Resize);
  4774. __utils_6.arr.merge(actions.eventTypes, ['resizestart', 'resizemove', 'resizeinertiastart', 'resizeresume', 'resizeend']);
  4775. actions.methodDict.resize = 'resizable';
  4776. defaults.actions.resize = resize.defaults;
  4777. }
  4778. var resize = {
  4779. id: 'actions/resize',
  4780. install: __install_6,
  4781. defaults: {
  4782. square: false,
  4783. preserveAspectRatio: false,
  4784. axis: 'xy',
  4785. // use default margin
  4786. margin: NaN,
  4787. // object with props left, right, top, bottom which are
  4788. // true/false values to resize when the pointer is over that edge,
  4789. // CSS selectors to match the handles for each direction
  4790. // or the Elements for each handle
  4791. edges: null,
  4792. // a value of 'none' will limit the resize rect to a minimum of 0x0
  4793. // 'negate' will alow the rect to have negative width/height
  4794. // 'reposition' will keep the width/height positive by swapping
  4795. // the top and bottom edges and/or swapping the left and right edges
  4796. invert: 'none'
  4797. },
  4798. checker: function checker(_pointer, _event, interactable, element, interaction, rect) {
  4799. if (!rect) {
  4800. return null;
  4801. }
  4802. var page = __utils_6.extend({}, interaction.coords.cur.page);
  4803. var options = interactable.options;
  4804. if (options.resize.enabled) {
  4805. var resizeOptions = options.resize;
  4806. var resizeEdges = {
  4807. left: false,
  4808. right: false,
  4809. top: false,
  4810. bottom: false
  4811. }; // if using resize.edges
  4812. if (__utils_6.is.object(resizeOptions.edges)) {
  4813. for (var edge in resizeEdges) {
  4814. resizeEdges[edge] = checkResizeEdge(edge, resizeOptions.edges[edge], page, interaction._latestPointer.eventTarget, element, rect, resizeOptions.margin || this.defaultMargin);
  4815. }
  4816. resizeEdges.left = resizeEdges.left && !resizeEdges.right;
  4817. resizeEdges.top = resizeEdges.top && !resizeEdges.bottom;
  4818. if (resizeEdges.left || resizeEdges.right || resizeEdges.top || resizeEdges.bottom) {
  4819. return {
  4820. name: 'resize',
  4821. edges: resizeEdges
  4822. };
  4823. }
  4824. } else {
  4825. var right = options.resize.axis !== 'y' && page.x > rect.right - this.defaultMargin;
  4826. var bottom = options.resize.axis !== 'x' && page.y > rect.bottom - this.defaultMargin;
  4827. if (right || bottom) {
  4828. return {
  4829. name: 'resize',
  4830. axes: (right ? 'x' : '') + (bottom ? 'y' : '')
  4831. };
  4832. }
  4833. }
  4834. }
  4835. return null;
  4836. },
  4837. cursors: null,
  4838. getCursor: function getCursor(action) {
  4839. var cursors = resize.cursors;
  4840. if (action.axis) {
  4841. return cursors[action.name + action.axis];
  4842. } else if (action.edges) {
  4843. var cursorKey = '';
  4844. var edgeNames = ['top', 'bottom', 'left', 'right'];
  4845. for (var i = 0; i < 4; i++) {
  4846. if (action.edges[edgeNames[i]]) {
  4847. cursorKey += edgeNames[i];
  4848. }
  4849. }
  4850. return cursors[cursorKey];
  4851. }
  4852. return null;
  4853. },
  4854. defaultMargin: null
  4855. };
  4856. function resizable(interactable, options, scope) {
  4857. if (__utils_6.is.object(options)) {
  4858. interactable.options.resize.enabled = options.enabled !== false;
  4859. interactable.setPerAction('resize', options);
  4860. interactable.setOnEvents('resize', options);
  4861. if (__utils_6.is.string(options.axis) && /^x$|^y$|^xy$/.test(options.axis)) {
  4862. interactable.options.resize.axis = options.axis;
  4863. } else if (options.axis === null) {
  4864. interactable.options.resize.axis = scope.defaults.actions.resize.axis;
  4865. }
  4866. if (__utils_6.is.bool(options.preserveAspectRatio)) {
  4867. interactable.options.resize.preserveAspectRatio = options.preserveAspectRatio;
  4868. } else if (__utils_6.is.bool(options.square)) {
  4869. interactable.options.resize.square = options.square;
  4870. }
  4871. return interactable;
  4872. }
  4873. if (__utils_6.is.bool(options)) {
  4874. interactable.options.resize.enabled = options;
  4875. return interactable;
  4876. }
  4877. return interactable.options.resize;
  4878. }
  4879. function checkResizeEdge(name, value, page, element, interactableElement, rect, margin) {
  4880. // false, '', undefined, null
  4881. if (!value) {
  4882. return false;
  4883. } // true value, use pointer coords and element rect
  4884. if (value === true) {
  4885. // if dimensions are negative, "switch" edges
  4886. var width = __utils_6.is.number(rect.width) ? rect.width : rect.right - rect.left;
  4887. var height = __utils_6.is.number(rect.height) ? rect.height : rect.bottom - rect.top; // don't use margin greater than half the relevent dimension
  4888. margin = Math.min(margin, (name === 'left' || name === 'right' ? width : height) / 2);
  4889. if (width < 0) {
  4890. if (name === 'left') {
  4891. name = 'right';
  4892. } else if (name === 'right') {
  4893. name = 'left';
  4894. }
  4895. }
  4896. if (height < 0) {
  4897. if (name === 'top') {
  4898. name = 'bottom';
  4899. } else if (name === 'bottom') {
  4900. name = 'top';
  4901. }
  4902. }
  4903. if (name === 'left') {
  4904. return page.x < (width >= 0 ? rect.left : rect.right) + margin;
  4905. }
  4906. if (name === 'top') {
  4907. return page.y < (height >= 0 ? rect.top : rect.bottom) + margin;
  4908. }
  4909. if (name === 'right') {
  4910. return page.x > (width >= 0 ? rect.right : rect.left) - margin;
  4911. }
  4912. if (name === 'bottom') {
  4913. return page.y > (height >= 0 ? rect.bottom : rect.top) - margin;
  4914. }
  4915. } // the remaining checks require an element
  4916. if (!__utils_6.is.element(element)) {
  4917. return false;
  4918. }
  4919. return __utils_6.is.element(value) // the value is an element to use as a resize handle
  4920. ? value === element // otherwise check if element matches value as selector
  4921. : __utils_6.dom.matchesUpTo(element, value, interactableElement);
  4922. }
  4923. function initCursors(browser) {
  4924. return browser.isIe9 ? {
  4925. x: 'e-resize',
  4926. y: 's-resize',
  4927. xy: 'se-resize',
  4928. top: 'n-resize',
  4929. left: 'w-resize',
  4930. bottom: 's-resize',
  4931. right: 'e-resize',
  4932. topleft: 'se-resize',
  4933. bottomright: 'se-resize',
  4934. topright: 'ne-resize',
  4935. bottomleft: 'ne-resize'
  4936. } : {
  4937. x: 'ew-resize',
  4938. y: 'ns-resize',
  4939. xy: 'nwse-resize',
  4940. top: 'ns-resize',
  4941. left: 'ew-resize',
  4942. bottom: 'ns-resize',
  4943. right: 'ew-resize',
  4944. topleft: 'nwse-resize',
  4945. bottomright: 'nwse-resize',
  4946. topright: 'nesw-resize',
  4947. bottomleft: 'nesw-resize'
  4948. };
  4949. }
  4950. function start(_ref) {
  4951. var iEvent = _ref.iEvent,
  4952. interaction = _ref.interaction;
  4953. if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {
  4954. return;
  4955. }
  4956. var startRect = interaction.rect;
  4957. var resizeOptions = interaction.interactable.options.resize;
  4958. /*
  4959. * When using the `resizable.square` or `resizable.preserveAspectRatio` options, resizing from one edge
  4960. * will affect another. E.g. with `resizable.square`, resizing to make the right edge larger will make
  4961. * the bottom edge larger by the same amount. We call these 'linked' edges. Any linked edges will depend
  4962. * on the active edges and the edge being interacted with.
  4963. */
  4964. if (resizeOptions.square || resizeOptions.preserveAspectRatio) {
  4965. var linkedEdges = __utils_6.extend({}, interaction.prepared.edges);
  4966. linkedEdges.top = linkedEdges.top || linkedEdges.left && !linkedEdges.bottom;
  4967. linkedEdges.left = linkedEdges.left || linkedEdges.top && !linkedEdges.right;
  4968. linkedEdges.bottom = linkedEdges.bottom || linkedEdges.right && !linkedEdges.top;
  4969. linkedEdges.right = linkedEdges.right || linkedEdges.bottom && !linkedEdges.left;
  4970. interaction.prepared._linkedEdges = linkedEdges;
  4971. } else {
  4972. interaction.prepared._linkedEdges = null;
  4973. } // if using `resizable.preserveAspectRatio` option, record aspect ratio at the start of the resize
  4974. if (resizeOptions.preserveAspectRatio) {
  4975. interaction.resizeStartAspectRatio = startRect.width / startRect.height;
  4976. }
  4977. interaction.resizeRects = {
  4978. start: startRect,
  4979. current: __utils_6.extend({}, startRect),
  4980. inverted: __utils_6.extend({}, startRect),
  4981. previous: __utils_6.extend({}, startRect),
  4982. delta: {
  4983. left: 0,
  4984. right: 0,
  4985. width: 0,
  4986. top: 0,
  4987. bottom: 0,
  4988. height: 0
  4989. }
  4990. };
  4991. iEvent.rect = interaction.resizeRects.inverted;
  4992. iEvent.deltaRect = interaction.resizeRects.delta;
  4993. }
  4994. function __move_6(_ref2) {
  4995. var iEvent = _ref2.iEvent,
  4996. interaction = _ref2.interaction;
  4997. if (interaction.prepared.name !== 'resize' || !interaction.prepared.edges) {
  4998. return;
  4999. }
  5000. var resizeOptions = interaction.interactable.options.resize;
  5001. var invert = resizeOptions.invert;
  5002. var invertible = invert === 'reposition' || invert === 'negate';
  5003. var edges = interaction.prepared.edges; // eslint-disable-next-line no-shadow
  5004. var start = interaction.resizeRects.start;
  5005. var current = interaction.resizeRects.current;
  5006. var inverted = interaction.resizeRects.inverted;
  5007. var deltaRect = interaction.resizeRects.delta;
  5008. var previous = __utils_6.extend(interaction.resizeRects.previous, inverted);
  5009. var originalEdges = edges;
  5010. var eventDelta = __utils_6.extend({}, iEvent.delta);
  5011. if (resizeOptions.preserveAspectRatio || resizeOptions.square) {
  5012. // `resize.preserveAspectRatio` takes precedence over `resize.square`
  5013. var startAspectRatio = resizeOptions.preserveAspectRatio ? interaction.resizeStartAspectRatio : 1;
  5014. edges = interaction.prepared._linkedEdges;
  5015. if (originalEdges.left && originalEdges.bottom || originalEdges.right && originalEdges.top) {
  5016. eventDelta.y = -eventDelta.x / startAspectRatio;
  5017. } else if (originalEdges.left || originalEdges.right) {
  5018. eventDelta.y = eventDelta.x / startAspectRatio;
  5019. } else if (originalEdges.top || originalEdges.bottom) {
  5020. eventDelta.x = eventDelta.y * startAspectRatio;
  5021. }
  5022. } // update the 'current' rect without modifications
  5023. if (edges.top) {
  5024. current.top += eventDelta.y;
  5025. }
  5026. if (edges.bottom) {
  5027. current.bottom += eventDelta.y;
  5028. }
  5029. if (edges.left) {
  5030. current.left += eventDelta.x;
  5031. }
  5032. if (edges.right) {
  5033. current.right += eventDelta.x;
  5034. }
  5035. if (invertible) {
  5036. // if invertible, copy the current rect
  5037. __utils_6.extend(inverted, current);
  5038. if (invert === 'reposition') {
  5039. // swap edge values if necessary to keep width/height positive
  5040. var swap;
  5041. if (inverted.top > inverted.bottom) {
  5042. swap = inverted.top;
  5043. inverted.top = inverted.bottom;
  5044. inverted.bottom = swap;
  5045. }
  5046. if (inverted.left > inverted.right) {
  5047. swap = inverted.left;
  5048. inverted.left = inverted.right;
  5049. inverted.right = swap;
  5050. }
  5051. }
  5052. } else {
  5053. // if not invertible, restrict to minimum of 0x0 rect
  5054. inverted.top = Math.min(current.top, start.bottom);
  5055. inverted.bottom = Math.max(current.bottom, start.top);
  5056. inverted.left = Math.min(current.left, start.right);
  5057. inverted.right = Math.max(current.right, start.left);
  5058. }
  5059. inverted.width = inverted.right - inverted.left;
  5060. inverted.height = inverted.bottom - inverted.top;
  5061. for (var edge in inverted) {
  5062. deltaRect[edge] = inverted[edge] - previous[edge];
  5063. }
  5064. iEvent.edges = interaction.prepared.edges;
  5065. iEvent.rect = inverted;
  5066. iEvent.deltaRect = deltaRect;
  5067. }
  5068. function updateEventAxes(_ref3) {
  5069. var interaction = _ref3.interaction,
  5070. iEvent = _ref3.iEvent,
  5071. action = _ref3.action;
  5072. if (action !== 'resize' || !interaction.resizeAxes) {
  5073. return;
  5074. }
  5075. var options = interaction.interactable.options;
  5076. if (options.resize.square) {
  5077. if (interaction.resizeAxes === 'y') {
  5078. iEvent.delta.x = iEvent.delta.y;
  5079. } else {
  5080. iEvent.delta.y = iEvent.delta.x;
  5081. }
  5082. iEvent.axes = 'xy';
  5083. } else {
  5084. iEvent.axes = interaction.resizeAxes;
  5085. if (interaction.resizeAxes === 'x') {
  5086. iEvent.delta.y = 0;
  5087. } else if (interaction.resizeAxes === 'y') {
  5088. iEvent.delta.x = 0;
  5089. }
  5090. }
  5091. }
  5092. var ___default_6 = resize;
  5093. _$resize_6["default"] = ___default_6;
  5094. var _$actions_5 = {};
  5095. "use strict";
  5096. Object.defineProperty(_$actions_5, "__esModule", {
  5097. value: true
  5098. });
  5099. _$actions_5.install = __install_5;
  5100. Object.defineProperty(_$actions_5, "drag", {
  5101. enumerable: true,
  5102. get: function get() {
  5103. return ___drag_5["default"];
  5104. }
  5105. });
  5106. Object.defineProperty(_$actions_5, "drop", {
  5107. enumerable: true,
  5108. get: function get() {
  5109. return _drop["default"];
  5110. }
  5111. });
  5112. Object.defineProperty(_$actions_5, "gesture", {
  5113. enumerable: true,
  5114. get: function get() {
  5115. return _gesture["default"];
  5116. }
  5117. });
  5118. Object.defineProperty(_$actions_5, "resize", {
  5119. enumerable: true,
  5120. get: function get() {
  5121. return _resize["default"];
  5122. }
  5123. });
  5124. _$actions_5.id = void 0;
  5125. var ___drag_5 = ___interopRequireDefault_5(_$drag_1);
  5126. var _drop = ___interopRequireDefault_5(_$drop_3);
  5127. var _gesture = ___interopRequireDefault_5(_$gesture_4);
  5128. var _resize = ___interopRequireDefault_5(_$resize_6);
  5129. function ___interopRequireDefault_5(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5130. function __install_5(scope) {
  5131. scope.usePlugin(_gesture["default"]);
  5132. scope.usePlugin(_resize["default"]);
  5133. scope.usePlugin(___drag_5["default"]);
  5134. scope.usePlugin(_drop["default"]);
  5135. }
  5136. var id = 'actions';
  5137. _$actions_5.id = id;
  5138. var _$autoScroll_7 = {};
  5139. "use strict";
  5140. Object.defineProperty(_$autoScroll_7, "__esModule", {
  5141. value: true
  5142. });
  5143. _$autoScroll_7.getContainer = getContainer;
  5144. _$autoScroll_7.getScroll = getScroll;
  5145. _$autoScroll_7.getScrollSize = getScrollSize;
  5146. _$autoScroll_7.getScrollSizeDelta = getScrollSizeDelta;
  5147. _$autoScroll_7["default"] = void 0;
  5148. var __domUtils_7 = ___interopRequireWildcard_7(_$domUtils_50);
  5149. var __is_7 = ___interopRequireWildcard_7(_$is_56);
  5150. var ___raf_7 = ___interopRequireDefault_7(_$raf_61);
  5151. /* removed: var _$rect_62 = require("@interactjs/utils/rect"); */;
  5152. /* removed: var _$window_65 = require("@interactjs/utils/window"); */;
  5153. function ___interopRequireDefault_7(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5154. function ___interopRequireWildcard_7(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  5155. function __install_7(scope) {
  5156. var interactions = scope.interactions,
  5157. defaults = scope.defaults,
  5158. actions = scope.actions;
  5159. scope.autoScroll = autoScroll;
  5160. autoScroll.now = function () {
  5161. return scope.now();
  5162. };
  5163. interactions.signals.on('new', function (_ref) {
  5164. var interaction = _ref.interaction;
  5165. interaction.autoScroll = null;
  5166. });
  5167. interactions.signals.on('destroy', function (_ref2) {
  5168. var interaction = _ref2.interaction;
  5169. interaction.autoScroll = null;
  5170. autoScroll.stop();
  5171. if (autoScroll.interaction) {
  5172. autoScroll.interaction = null;
  5173. }
  5174. });
  5175. interactions.signals.on('stop', autoScroll.stop);
  5176. interactions.signals.on('action-move', function (arg) {
  5177. return autoScroll.onInteractionMove(arg);
  5178. });
  5179. actions.eventTypes.push('autoscroll');
  5180. defaults.perAction.autoScroll = autoScroll.defaults;
  5181. }
  5182. var autoScroll = {
  5183. defaults: {
  5184. enabled: false,
  5185. margin: 60,
  5186. // the item that is scrolled (Window or HTMLElement)
  5187. container: null,
  5188. // the scroll speed in pixels per second
  5189. speed: 300
  5190. },
  5191. now: Date.now,
  5192. interaction: null,
  5193. i: null,
  5194. x: 0,
  5195. y: 0,
  5196. isScrolling: false,
  5197. prevTime: 0,
  5198. margin: 0,
  5199. speed: 0,
  5200. start: function start(interaction) {
  5201. autoScroll.isScrolling = true;
  5202. ___raf_7["default"].cancel(autoScroll.i);
  5203. interaction.autoScroll = autoScroll;
  5204. autoScroll.interaction = interaction;
  5205. autoScroll.prevTime = autoScroll.now();
  5206. autoScroll.i = ___raf_7["default"].request(autoScroll.scroll);
  5207. },
  5208. stop: function stop() {
  5209. autoScroll.isScrolling = false;
  5210. if (autoScroll.interaction) {
  5211. autoScroll.interaction.autoScroll = null;
  5212. }
  5213. ___raf_7["default"].cancel(autoScroll.i);
  5214. },
  5215. // scroll the window by the values in scroll.x/y
  5216. scroll: function scroll() {
  5217. var interaction = autoScroll.interaction;
  5218. var interactable = interaction.interactable,
  5219. element = interaction.element;
  5220. var options = interactable.options[autoScroll.interaction.prepared.name].autoScroll;
  5221. var container = getContainer(options.container, interactable, element);
  5222. var now = autoScroll.now(); // change in time in seconds
  5223. var dt = (now - autoScroll.prevTime) / 1000; // displacement
  5224. var s = options.speed * dt;
  5225. if (s >= 1) {
  5226. var scrollBy = {
  5227. x: autoScroll.x * s,
  5228. y: autoScroll.y * s
  5229. };
  5230. if (scrollBy.x || scrollBy.y) {
  5231. var prevScroll = getScroll(container);
  5232. if (__is_7.window(container)) {
  5233. container.scrollBy(scrollBy.x, scrollBy.y);
  5234. } else if (container) {
  5235. container.scrollLeft += scrollBy.x;
  5236. container.scrollTop += scrollBy.y;
  5237. }
  5238. var curScroll = getScroll(container);
  5239. var delta = {
  5240. x: curScroll.x - prevScroll.x,
  5241. y: curScroll.y - prevScroll.y
  5242. };
  5243. if (delta.x || delta.y) {
  5244. interactable.fire({
  5245. type: 'autoscroll',
  5246. target: element,
  5247. interactable: interactable,
  5248. delta: delta,
  5249. interaction: interaction,
  5250. container: container
  5251. });
  5252. }
  5253. }
  5254. autoScroll.prevTime = now;
  5255. }
  5256. if (autoScroll.isScrolling) {
  5257. ___raf_7["default"].cancel(autoScroll.i);
  5258. autoScroll.i = ___raf_7["default"].request(autoScroll.scroll);
  5259. }
  5260. },
  5261. check: function check(interactable, actionName) {
  5262. var options = interactable.options;
  5263. return options[actionName].autoScroll && options[actionName].autoScroll.enabled;
  5264. },
  5265. onInteractionMove: function onInteractionMove(_ref3) {
  5266. var interaction = _ref3.interaction,
  5267. pointer = _ref3.pointer;
  5268. if (!(interaction.interacting() && autoScroll.check(interaction.interactable, interaction.prepared.name))) {
  5269. return;
  5270. }
  5271. if (interaction.simulation) {
  5272. autoScroll.x = autoScroll.y = 0;
  5273. return;
  5274. }
  5275. var top;
  5276. var right;
  5277. var bottom;
  5278. var left;
  5279. var interactable = interaction.interactable,
  5280. element = interaction.element;
  5281. var options = interactable.options[interaction.prepared.name].autoScroll;
  5282. var container = getContainer(options.container, interactable, element);
  5283. if (__is_7.window(container)) {
  5284. left = pointer.clientX < autoScroll.margin;
  5285. top = pointer.clientY < autoScroll.margin;
  5286. right = pointer.clientX > container.innerWidth - autoScroll.margin;
  5287. bottom = pointer.clientY > container.innerHeight - autoScroll.margin;
  5288. } else {
  5289. var rect = __domUtils_7.getElementClientRect(container);
  5290. left = pointer.clientX < rect.left + autoScroll.margin;
  5291. top = pointer.clientY < rect.top + autoScroll.margin;
  5292. right = pointer.clientX > rect.right - autoScroll.margin;
  5293. bottom = pointer.clientY > rect.bottom - autoScroll.margin;
  5294. }
  5295. autoScroll.x = right ? 1 : left ? -1 : 0;
  5296. autoScroll.y = bottom ? 1 : top ? -1 : 0;
  5297. if (!autoScroll.isScrolling) {
  5298. // set the autoScroll properties to those of the target
  5299. autoScroll.margin = options.margin;
  5300. autoScroll.speed = options.speed;
  5301. autoScroll.start(interaction);
  5302. }
  5303. }
  5304. };
  5305. function getContainer(value, interactable, element) {
  5306. return (__is_7.string(value) ? (0, _$rect_62.getStringOptionResult)(value, interactable, element) : value) || (0, _$window_65.getWindow)(element);
  5307. }
  5308. function getScroll(container) {
  5309. if (__is_7.window(container)) {
  5310. container = window.document.body;
  5311. }
  5312. return {
  5313. x: container.scrollLeft,
  5314. y: container.scrollTop
  5315. };
  5316. }
  5317. function getScrollSize(container) {
  5318. if (__is_7.window(container)) {
  5319. container = window.document.body;
  5320. }
  5321. return {
  5322. x: container.scrollWidth,
  5323. y: container.scrollHeight
  5324. };
  5325. }
  5326. function getScrollSizeDelta(_ref4, func) {
  5327. var interaction = _ref4.interaction,
  5328. element = _ref4.element;
  5329. var scrollOptions = interaction && interaction.interactable.options[interaction.prepared.name].autoScroll;
  5330. if (!scrollOptions || !scrollOptions.enabled) {
  5331. func();
  5332. return {
  5333. x: 0,
  5334. y: 0
  5335. };
  5336. }
  5337. var scrollContainer = getContainer(scrollOptions.container, interaction.interactable, element);
  5338. var prevSize = getScroll(scrollContainer);
  5339. func();
  5340. var curSize = getScroll(scrollContainer);
  5341. return {
  5342. x: curSize.x - prevSize.x,
  5343. y: curSize.y - prevSize.y
  5344. };
  5345. }
  5346. var ___default_7 = {
  5347. id: 'auto-scroll',
  5348. install: __install_7
  5349. };
  5350. _$autoScroll_7["default"] = ___default_7;
  5351. var _$InteractableMethods_8 = {};
  5352. "use strict";
  5353. Object.defineProperty(_$InteractableMethods_8, "__esModule", {
  5354. value: true
  5355. });
  5356. _$InteractableMethods_8["default"] = void 0;
  5357. /* removed: var _$utils_55 = require("@interactjs/utils"); */;
  5358. var __is_8 = ___interopRequireWildcard_8(_$is_56);
  5359. function ___interopRequireWildcard_8(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  5360. function __install_8(scope) {
  5361. var Interactable = scope.Interactable,
  5362. actions = scope.actions;
  5363. Interactable.prototype.getAction = getAction;
  5364. /**
  5365. * ```js
  5366. * interact(element, { ignoreFrom: document.getElementById('no-action') })
  5367. * // or
  5368. * interact(element).ignoreFrom('input, textarea, a')
  5369. * ```
  5370. * @deprecated
  5371. * If the target of the `mousedown`, `pointerdown` or `touchstart` event or any
  5372. * of it's parents match the given CSS selector or Element, no
  5373. * drag/resize/gesture is started.
  5374. *
  5375. * Don't use this method. Instead set the `ignoreFrom` option for each action
  5376. * or for `pointerEvents`
  5377. *
  5378. * @example
  5379. * interact(targett)
  5380. * .draggable({
  5381. * ignoreFrom: 'input, textarea, a[href]'',
  5382. * })
  5383. * .pointerEvents({
  5384. * ignoreFrom: '[no-pointer]',
  5385. * })
  5386. *
  5387. * @param {string | Element | null} [newValue] a CSS selector string, an
  5388. * Element or `null` to not ignore any elements
  5389. * @return {string | Element | object} The current ignoreFrom value or this
  5390. * Interactable
  5391. */
  5392. Interactable.prototype.ignoreFrom = (0, _$utils_55.warnOnce)(function (newValue) {
  5393. return this._backCompatOption('ignoreFrom', newValue);
  5394. }, 'Interactable.ignoreFrom() has been deprecated. Use Interactble.draggable({ignoreFrom: newValue}).');
  5395. /**
  5396. * @deprecated
  5397. *
  5398. * A drag/resize/gesture is started only If the target of the `mousedown`,
  5399. * `pointerdown` or `touchstart` event or any of it's parents match the given
  5400. * CSS selector or Element.
  5401. *
  5402. * Don't use this method. Instead set the `allowFrom` option for each action
  5403. * or for `pointerEvents`
  5404. *
  5405. * @example
  5406. * interact(targett)
  5407. * .resizable({
  5408. * allowFrom: '.resize-handle',
  5409. * .pointerEvents({
  5410. * allowFrom: '.handle',,
  5411. * })
  5412. *
  5413. * @param {string | Element | null} [newValue] a CSS selector string, an
  5414. * Element or `null` to allow from any element
  5415. * @return {string | Element | object} The current allowFrom value or this
  5416. * Interactable
  5417. */
  5418. Interactable.prototype.allowFrom = (0, _$utils_55.warnOnce)(function (newValue) {
  5419. return this._backCompatOption('allowFrom', newValue);
  5420. }, 'Interactable.allowFrom() has been deprecated. Use Interactble.draggable({allowFrom: newValue}).');
  5421. /**
  5422. * ```js
  5423. * interact('.resize-drag')
  5424. * .resizable(true)
  5425. * .draggable(true)
  5426. * .actionChecker(function (pointer, event, action, interactable, element, interaction) {
  5427. *
  5428. * if (interact.matchesSelector(event.target, '.drag-handle')) {
  5429. * // force drag with handle target
  5430. * action.name = drag
  5431. * }
  5432. * else {
  5433. * // resize from the top and right edges
  5434. * action.name = 'resize'
  5435. * action.edges = { top: true, right: true }
  5436. * }
  5437. *
  5438. * return action
  5439. * })
  5440. * ```
  5441. *
  5442. * Returns or sets the function used to check action to be performed on
  5443. * pointerDown
  5444. *
  5445. * @param {function | null} [checker] A function which takes a pointer event,
  5446. * defaultAction string, interactable, element and interaction as parameters
  5447. * and returns an object with name property 'drag' 'resize' or 'gesture' and
  5448. * optionally an `edges` object with boolean 'top', 'left', 'bottom' and right
  5449. * props.
  5450. * @return {Function | Interactable} The checker function or this Interactable
  5451. */
  5452. Interactable.prototype.actionChecker = actionChecker;
  5453. /**
  5454. * Returns or sets whether the the cursor should be changed depending on the
  5455. * action that would be performed if the mouse were pressed and dragged.
  5456. *
  5457. * @param {boolean} [newValue]
  5458. * @return {boolean | Interactable} The current setting or this Interactable
  5459. */
  5460. Interactable.prototype.styleCursor = styleCursor;
  5461. Interactable.prototype.defaultActionChecker = function (pointer, event, interaction, element) {
  5462. return defaultActionChecker(this, pointer, event, interaction, element, actions);
  5463. };
  5464. }
  5465. function getAction(pointer, event, interaction, element) {
  5466. var action = this.defaultActionChecker(pointer, event, interaction, element);
  5467. if (this.options.actionChecker) {
  5468. return this.options.actionChecker(pointer, event, action, this, element, interaction);
  5469. }
  5470. return action;
  5471. }
  5472. function defaultActionChecker(interactable, pointer, event, interaction, element, actions) {
  5473. var rect = interactable.getRect(element);
  5474. var buttons = event.buttons || {
  5475. 0: 1,
  5476. 1: 4,
  5477. 3: 8,
  5478. 4: 16
  5479. }[event.button];
  5480. var action = null;
  5481. for (var _i = 0; _i < actions.names.length; _i++) {
  5482. var _ref;
  5483. _ref = actions.names[_i];
  5484. var actionName = _ref;
  5485. // check mouseButton setting if the pointer is down
  5486. if (interaction.pointerIsDown && /mouse|pointer/.test(interaction.pointerType) && (buttons & interactable.options[actionName].mouseButtons) === 0) {
  5487. continue;
  5488. }
  5489. action = actions[actionName].checker(pointer, event, interactable, element, interaction, rect);
  5490. if (action) {
  5491. return action;
  5492. }
  5493. }
  5494. }
  5495. function styleCursor(newValue) {
  5496. if (__is_8.bool(newValue)) {
  5497. this.options.styleCursor = newValue;
  5498. return this;
  5499. }
  5500. if (newValue === null) {
  5501. delete this.options.styleCursor;
  5502. return this;
  5503. }
  5504. return this.options.styleCursor;
  5505. }
  5506. function actionChecker(checker) {
  5507. if (__is_8.func(checker)) {
  5508. this.options.actionChecker = checker;
  5509. return this;
  5510. }
  5511. if (checker === null) {
  5512. delete this.options.actionChecker;
  5513. return this;
  5514. }
  5515. return this.options.actionChecker;
  5516. }
  5517. var ___default_8 = {
  5518. id: 'auto-start/interactableMethods',
  5519. install: __install_8
  5520. };
  5521. _$InteractableMethods_8["default"] = ___default_8;
  5522. var _$base_9 = {};
  5523. "use strict";
  5524. Object.defineProperty(_$base_9, "__esModule", {
  5525. value: true
  5526. });
  5527. _$base_9["default"] = void 0;
  5528. var __utils_9 = ___interopRequireWildcard_9(_$utils_55);
  5529. var _InteractableMethods = ___interopRequireDefault_9(_$InteractableMethods_8);
  5530. function ___interopRequireDefault_9(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5531. function ___interopRequireWildcard_9(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  5532. function __install_9(scope) {
  5533. var interact = scope.interact,
  5534. interactions = scope.interactions,
  5535. defaults = scope.defaults;
  5536. scope.usePlugin(_InteractableMethods["default"]); // set cursor style on mousedown
  5537. interactions.signals.on('down', function (_ref) {
  5538. var interaction = _ref.interaction,
  5539. pointer = _ref.pointer,
  5540. event = _ref.event,
  5541. eventTarget = _ref.eventTarget;
  5542. if (interaction.interacting()) {
  5543. return;
  5544. }
  5545. var actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope);
  5546. prepare(interaction, actionInfo, scope);
  5547. }); // set cursor style on mousemove
  5548. interactions.signals.on('move', function (_ref2) {
  5549. var interaction = _ref2.interaction,
  5550. pointer = _ref2.pointer,
  5551. event = _ref2.event,
  5552. eventTarget = _ref2.eventTarget;
  5553. if (interaction.pointerType !== 'mouse' || interaction.pointerIsDown || interaction.interacting()) {
  5554. return;
  5555. }
  5556. var actionInfo = getActionInfo(interaction, pointer, event, eventTarget, scope);
  5557. prepare(interaction, actionInfo, scope);
  5558. });
  5559. interactions.signals.on('move', function (arg) {
  5560. var interaction = arg.interaction;
  5561. if (!interaction.pointerIsDown || interaction.interacting() || !interaction.pointerWasMoved || !interaction.prepared.name) {
  5562. return;
  5563. }
  5564. scope.autoStart.signals.fire('before-start', arg);
  5565. var interactable = interaction.interactable;
  5566. if (interaction.prepared.name && interactable) {
  5567. // check manualStart and interaction limit
  5568. if (interactable.options[interaction.prepared.name].manualStart || !withinInteractionLimit(interactable, interaction.element, interaction.prepared, scope)) {
  5569. interaction.stop();
  5570. } else {
  5571. interaction.start(interaction.prepared, interactable, interaction.element);
  5572. }
  5573. }
  5574. });
  5575. interactions.signals.on('stop', function (_ref3) {
  5576. var interaction = _ref3.interaction;
  5577. var interactable = interaction.interactable;
  5578. if (interactable && interactable.options.styleCursor) {
  5579. setCursor(interaction.element, '', scope);
  5580. }
  5581. });
  5582. defaults.base.actionChecker = null;
  5583. defaults.base.styleCursor = true;
  5584. __utils_9.extend(defaults.perAction, {
  5585. manualStart: false,
  5586. max: Infinity,
  5587. maxPerElement: 1,
  5588. allowFrom: null,
  5589. ignoreFrom: null,
  5590. // only allow left button by default
  5591. // see https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/buttons#Return_value
  5592. mouseButtons: 1
  5593. });
  5594. /**
  5595. * Returns or sets the maximum number of concurrent interactions allowed. By
  5596. * default only 1 interaction is allowed at a time (for backwards
  5597. * compatibility). To allow multiple interactions on the same Interactables and
  5598. * elements, you need to enable it in the draggable, resizable and gesturable
  5599. * `'max'` and `'maxPerElement'` options.
  5600. *
  5601. * @alias module:interact.maxInteractions
  5602. *
  5603. * @param {number} [newValue] Any number. newValue <= 0 means no interactions.
  5604. */
  5605. interact.maxInteractions = function (newValue) {
  5606. return maxInteractions(newValue, scope);
  5607. };
  5608. scope.autoStart = {
  5609. // Allow this many interactions to happen simultaneously
  5610. maxInteractions: Infinity,
  5611. withinInteractionLimit: withinInteractionLimit,
  5612. cursorElement: null,
  5613. signals: new __utils_9.Signals()
  5614. };
  5615. } // Check if the current interactable supports the action.
  5616. // If so, return the validated action. Otherwise, return null
  5617. function validateAction(action, interactable, element, eventTarget, scope) {
  5618. if (interactable.testIgnoreAllow(interactable.options[action.name], element, eventTarget) && interactable.options[action.name].enabled && withinInteractionLimit(interactable, element, action, scope)) {
  5619. return action;
  5620. }
  5621. return null;
  5622. }
  5623. function validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope) {
  5624. for (var i = 0, len = matches.length; i < len; i++) {
  5625. var match = matches[i];
  5626. var matchElement = matchElements[i];
  5627. var matchAction = match.getAction(pointer, event, interaction, matchElement);
  5628. if (!matchAction) {
  5629. continue;
  5630. }
  5631. var action = validateAction(matchAction, match, matchElement, eventTarget, scope);
  5632. if (action) {
  5633. return {
  5634. action: action,
  5635. interactable: match,
  5636. element: matchElement
  5637. };
  5638. }
  5639. }
  5640. return {
  5641. action: null,
  5642. interactable: null,
  5643. element: null
  5644. };
  5645. }
  5646. function getActionInfo(interaction, pointer, event, eventTarget, scope) {
  5647. var matches = [];
  5648. var matchElements = [];
  5649. var element = eventTarget;
  5650. function pushMatches(interactable) {
  5651. matches.push(interactable);
  5652. matchElements.push(element);
  5653. }
  5654. while (__utils_9.is.element(element)) {
  5655. matches = [];
  5656. matchElements = [];
  5657. scope.interactables.forEachMatch(element, pushMatches);
  5658. var actionInfo = validateMatches(interaction, pointer, event, matches, matchElements, eventTarget, scope);
  5659. if (actionInfo.action && !actionInfo.interactable.options[actionInfo.action.name].manualStart) {
  5660. return actionInfo;
  5661. }
  5662. element = __utils_9.dom.parentNode(element);
  5663. }
  5664. return {
  5665. action: null,
  5666. interactable: null,
  5667. element: null
  5668. };
  5669. }
  5670. function prepare(interaction, _ref4, scope) {
  5671. var action = _ref4.action,
  5672. interactable = _ref4.interactable,
  5673. element = _ref4.element;
  5674. action = action || {};
  5675. if (interaction.interactable && interaction.interactable.options.styleCursor) {
  5676. setCursor(interaction.element, '', scope);
  5677. }
  5678. interaction.interactable = interactable;
  5679. interaction.element = element;
  5680. __utils_9.copyAction(interaction.prepared, action);
  5681. interaction.rect = interactable && action.name ? interactable.getRect(element) : null;
  5682. if (interactable && interactable.options.styleCursor) {
  5683. var cursor = action ? scope.actions[action.name].getCursor(action) : '';
  5684. setCursor(interaction.element, cursor, scope);
  5685. }
  5686. scope.autoStart.signals.fire('prepared', {
  5687. interaction: interaction
  5688. });
  5689. }
  5690. function withinInteractionLimit(interactable, element, action, scope) {
  5691. var options = interactable.options;
  5692. var maxActions = options[action.name].max;
  5693. var maxPerElement = options[action.name].maxPerElement;
  5694. var autoStartMax = scope.autoStart.maxInteractions;
  5695. var activeInteractions = 0;
  5696. var interactableCount = 0;
  5697. var elementCount = 0; // no actions if any of these values == 0
  5698. if (!(maxActions && maxPerElement && autoStartMax)) {
  5699. return false;
  5700. }
  5701. for (var _i = 0; _i < scope.interactions.list.length; _i++) {
  5702. var _ref5;
  5703. _ref5 = scope.interactions.list[_i];
  5704. var interaction = _ref5;
  5705. var otherAction = interaction.prepared.name;
  5706. if (!interaction.interacting()) {
  5707. continue;
  5708. }
  5709. activeInteractions++;
  5710. if (activeInteractions >= autoStartMax) {
  5711. return false;
  5712. }
  5713. if (interaction.interactable !== interactable) {
  5714. continue;
  5715. }
  5716. interactableCount += otherAction === action.name ? 1 : 0;
  5717. if (interactableCount >= maxActions) {
  5718. return false;
  5719. }
  5720. if (interaction.element === element) {
  5721. elementCount++;
  5722. if (otherAction === action.name && elementCount >= maxPerElement) {
  5723. return false;
  5724. }
  5725. }
  5726. }
  5727. return autoStartMax > 0;
  5728. }
  5729. function maxInteractions(newValue, scope) {
  5730. if (__utils_9.is.number(newValue)) {
  5731. scope.autoStart.maxInteractions = newValue;
  5732. return this;
  5733. }
  5734. return scope.autoStart.maxInteractions;
  5735. }
  5736. function setCursor(element, cursor, scope) {
  5737. if (scope.autoStart.cursorElement) {
  5738. scope.autoStart.cursorElement.style.cursor = '';
  5739. }
  5740. element.ownerDocument.documentElement.style.cursor = cursor;
  5741. element.style.cursor = cursor;
  5742. scope.autoStart.cursorElement = cursor ? element : null;
  5743. }
  5744. var ___default_9 = {
  5745. id: 'auto-start/base',
  5746. install: __install_9,
  5747. maxInteractions: maxInteractions,
  5748. withinInteractionLimit: withinInteractionLimit,
  5749. validateAction: validateAction
  5750. };
  5751. _$base_9["default"] = ___default_9;
  5752. var _$dragAxis_10 = {};
  5753. "use strict";
  5754. Object.defineProperty(_$dragAxis_10, "__esModule", {
  5755. value: true
  5756. });
  5757. _$dragAxis_10["default"] = void 0;
  5758. var ___scope_10 = _$scope_24({});
  5759. /* removed: var _$domUtils_50 = require("@interactjs/utils/domUtils"); */;
  5760. var __is_10 = ___interopRequireWildcard_10(_$is_56);
  5761. var _base = ___interopRequireDefault_10(_$base_9);
  5762. function ___interopRequireDefault_10(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5763. function ___interopRequireWildcard_10(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  5764. function __install_10(scope) {
  5765. scope.autoStart.signals.on('before-start', function (_ref) {
  5766. var interaction = _ref.interaction,
  5767. eventTarget = _ref.eventTarget,
  5768. dx = _ref.dx,
  5769. dy = _ref.dy;
  5770. if (interaction.prepared.name !== 'drag') {
  5771. return;
  5772. } // check if a drag is in the correct axis
  5773. var absX = Math.abs(dx);
  5774. var absY = Math.abs(dy);
  5775. var targetOptions = interaction.interactable.options.drag;
  5776. var startAxis = targetOptions.startAxis;
  5777. var currentAxis = absX > absY ? 'x' : absX < absY ? 'y' : 'xy';
  5778. interaction.prepared.axis = targetOptions.lockAxis === 'start' ? currentAxis[0] // always lock to one axis even if currentAxis === 'xy'
  5779. : targetOptions.lockAxis; // if the movement isn't in the startAxis of the interactable
  5780. if (currentAxis !== 'xy' && startAxis !== 'xy' && startAxis !== currentAxis) {
  5781. // cancel the prepared action
  5782. interaction.prepared.name = null; // then try to get a drag from another ineractable
  5783. var element = eventTarget;
  5784. var getDraggable = function getDraggable(interactable) {
  5785. if (interactable === interaction.interactable) {
  5786. return;
  5787. }
  5788. var options = interaction.interactable.options.drag;
  5789. if (!options.manualStart && interactable.testIgnoreAllow(options, element, eventTarget)) {
  5790. var action = interactable.getAction(interaction.downPointer, interaction.downEvent, interaction, element);
  5791. if (action && action.name === ___scope_10.ActionName.Drag && checkStartAxis(currentAxis, interactable) && _base["default"].validateAction(action, interactable, element, eventTarget, scope)) {
  5792. return interactable;
  5793. }
  5794. }
  5795. }; // check all interactables
  5796. while (__is_10.element(element)) {
  5797. var interactable = scope.interactables.forEachMatch(element, getDraggable);
  5798. if (interactable) {
  5799. interaction.prepared.name = ___scope_10.ActionName.Drag;
  5800. interaction.interactable = interactable;
  5801. interaction.element = element;
  5802. break;
  5803. }
  5804. element = (0, _$domUtils_50.parentNode)(element);
  5805. }
  5806. }
  5807. });
  5808. function checkStartAxis(startAxis, interactable) {
  5809. if (!interactable) {
  5810. return false;
  5811. }
  5812. var thisAxis = interactable.options[___scope_10.ActionName.Drag].startAxis;
  5813. return startAxis === 'xy' || thisAxis === 'xy' || thisAxis === startAxis;
  5814. }
  5815. }
  5816. var ___default_10 = {
  5817. id: 'auto-start/dragAxis',
  5818. install: __install_10
  5819. };
  5820. _$dragAxis_10["default"] = ___default_10;
  5821. var _$hold_11 = {};
  5822. "use strict";
  5823. Object.defineProperty(_$hold_11, "__esModule", {
  5824. value: true
  5825. });
  5826. _$hold_11["default"] = void 0;
  5827. var ___base_11 = ___interopRequireDefault_11(_$base_9);
  5828. function ___interopRequireDefault_11(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5829. function __install_11(scope) {
  5830. var autoStart = scope.autoStart,
  5831. interactions = scope.interactions,
  5832. defaults = scope.defaults;
  5833. scope.usePlugin(___base_11["default"]);
  5834. defaults.perAction.hold = 0;
  5835. defaults.perAction.delay = 0;
  5836. interactions.signals.on('new', function (interaction) {
  5837. interaction.autoStartHoldTimer = null;
  5838. });
  5839. autoStart.signals.on('prepared', function (_ref) {
  5840. var interaction = _ref.interaction;
  5841. var hold = getHoldDuration(interaction);
  5842. if (hold > 0) {
  5843. interaction.autoStartHoldTimer = setTimeout(function () {
  5844. interaction.start(interaction.prepared, interaction.interactable, interaction.element);
  5845. }, hold);
  5846. }
  5847. });
  5848. interactions.signals.on('move', function (_ref2) {
  5849. var interaction = _ref2.interaction,
  5850. duplicate = _ref2.duplicate;
  5851. if (interaction.pointerWasMoved && !duplicate) {
  5852. clearTimeout(interaction.autoStartHoldTimer);
  5853. }
  5854. }); // prevent regular down->move autoStart
  5855. autoStart.signals.on('before-start', function (_ref3) {
  5856. var interaction = _ref3.interaction;
  5857. var hold = getHoldDuration(interaction);
  5858. if (hold > 0) {
  5859. interaction.prepared.name = null;
  5860. }
  5861. });
  5862. }
  5863. function getHoldDuration(interaction) {
  5864. var actionName = interaction.prepared && interaction.prepared.name;
  5865. if (!actionName) {
  5866. return null;
  5867. }
  5868. var options = interaction.interactable.options;
  5869. return options[actionName].hold || options[actionName].delay;
  5870. }
  5871. var ___default_11 = {
  5872. id: 'auto-start/hold',
  5873. install: __install_11,
  5874. getHoldDuration: getHoldDuration
  5875. };
  5876. _$hold_11["default"] = ___default_11;
  5877. var _$autoStart_12 = {};
  5878. "use strict";
  5879. Object.defineProperty(_$autoStart_12, "__esModule", {
  5880. value: true
  5881. });
  5882. _$autoStart_12.install = __install_12;
  5883. Object.defineProperty(_$autoStart_12, "autoStart", {
  5884. enumerable: true,
  5885. get: function get() {
  5886. return ___base_12["default"];
  5887. }
  5888. });
  5889. Object.defineProperty(_$autoStart_12, "dragAxis", {
  5890. enumerable: true,
  5891. get: function get() {
  5892. return _dragAxis["default"];
  5893. }
  5894. });
  5895. Object.defineProperty(_$autoStart_12, "hold", {
  5896. enumerable: true,
  5897. get: function get() {
  5898. return _hold["default"];
  5899. }
  5900. });
  5901. _$autoStart_12.id = void 0;
  5902. var ___base_12 = ___interopRequireDefault_12(_$base_9);
  5903. var _dragAxis = ___interopRequireDefault_12(_$dragAxis_10);
  5904. var _hold = ___interopRequireDefault_12(_$hold_11);
  5905. function ___interopRequireDefault_12(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5906. function __install_12(scope) {
  5907. scope.usePlugin(___base_12["default"]);
  5908. scope.usePlugin(_hold["default"]);
  5909. scope.usePlugin(_dragAxis["default"]);
  5910. }
  5911. var __id_12 = 'auto-start';
  5912. _$autoStart_12.id = __id_12;
  5913. var _$interactablePreventDefault_21 = {};
  5914. "use strict";
  5915. Object.defineProperty(_$interactablePreventDefault_21, "__esModule", {
  5916. value: true
  5917. });
  5918. _$interactablePreventDefault_21.install = __install_21;
  5919. _$interactablePreventDefault_21["default"] = void 0;
  5920. /* removed: var _$domUtils_50 = require("@interactjs/utils/domUtils"); */;
  5921. var ___events_21 = ___interopRequireDefault_21(_$events_51);
  5922. var __is_21 = ___interopRequireWildcard_21(_$is_56);
  5923. /* removed: var _$window_65 = require("@interactjs/utils/window"); */;
  5924. function ___interopRequireWildcard_21(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  5925. function ___interopRequireDefault_21(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  5926. function preventDefault(interactable, newValue) {
  5927. if (/^(always|never|auto)$/.test(newValue)) {
  5928. interactable.options.preventDefault = newValue;
  5929. return interactable;
  5930. }
  5931. if (__is_21.bool(newValue)) {
  5932. interactable.options.preventDefault = newValue ? 'always' : 'never';
  5933. return interactable;
  5934. }
  5935. return interactable.options.preventDefault;
  5936. }
  5937. function checkAndPreventDefault(interactable, scope, event) {
  5938. var setting = interactable.options.preventDefault;
  5939. if (setting === 'never') {
  5940. return;
  5941. }
  5942. if (setting === 'always') {
  5943. event.preventDefault();
  5944. return;
  5945. } // setting === 'auto'
  5946. // if the browser supports passive event listeners and isn't running on iOS,
  5947. // don't preventDefault of touch{start,move} events. CSS touch-action and
  5948. // user-select should be used instead of calling event.preventDefault().
  5949. if (___events_21["default"].supportsPassive && /^touch(start|move)$/.test(event.type)) {
  5950. var doc = (0, _$window_65.getWindow)(event.target).document;
  5951. var docOptions = scope.getDocOptions(doc);
  5952. if (!(docOptions && docOptions.events) || docOptions.events.passive !== false) {
  5953. return;
  5954. }
  5955. } // don't preventDefault of pointerdown events
  5956. if (/^(mouse|pointer|touch)*(down|start)/i.test(event.type)) {
  5957. return;
  5958. } // don't preventDefault on editable elements
  5959. if (__is_21.element(event.target) && (0, _$domUtils_50.matchesSelector)(event.target, 'input,select,textarea,[contenteditable=true],[contenteditable=true] *')) {
  5960. return;
  5961. }
  5962. event.preventDefault();
  5963. }
  5964. function onInteractionEvent(_ref) {
  5965. var interaction = _ref.interaction,
  5966. event = _ref.event;
  5967. if (interaction.interactable) {
  5968. interaction.interactable.checkAndPreventDefault(event);
  5969. }
  5970. }
  5971. function __install_21(scope) {
  5972. /** @lends Interactable */
  5973. var Interactable = scope.Interactable;
  5974. /**
  5975. * Returns or sets whether to prevent the browser's default behaviour in
  5976. * response to pointer events. Can be set to:
  5977. * - `'always'` to always prevent
  5978. * - `'never'` to never prevent
  5979. * - `'auto'` to let interact.js try to determine what would be best
  5980. *
  5981. * @param {string} [newValue] `'always'`, `'never'` or `'auto'`
  5982. * @return {string | Interactable} The current setting or this Interactable
  5983. */
  5984. Interactable.prototype.preventDefault = function (newValue) {
  5985. return preventDefault(this, newValue);
  5986. };
  5987. Interactable.prototype.checkAndPreventDefault = function (event) {
  5988. return checkAndPreventDefault(this, scope, event);
  5989. };
  5990. var _arr = ['down', 'move', 'up', 'cancel'];
  5991. for (var _i = 0; _i < _arr.length; _i++) {
  5992. var eventSignal = _arr[_i];
  5993. scope.interactions.signals.on(eventSignal, onInteractionEvent);
  5994. } // prevent native HTML5 drag on interact.js target elements
  5995. scope.interactions.eventMap.dragstart = function preventNativeDrag(event) {
  5996. for (var _i2 = 0; _i2 < scope.interactions.list.length; _i2++) {
  5997. var _ref2;
  5998. _ref2 = scope.interactions.list[_i2];
  5999. var interaction = _ref2;
  6000. if (interaction.element && (interaction.element === event.target || (0, _$domUtils_50.nodeContains)(interaction.element, event.target))) {
  6001. interaction.interactable.checkAndPreventDefault(event);
  6002. return;
  6003. }
  6004. }
  6005. };
  6006. }
  6007. var ___default_21 = {
  6008. id: 'core/interactablePreventDefault',
  6009. install: __install_21
  6010. };
  6011. _$interactablePreventDefault_21["default"] = ___default_21;
  6012. var _$devTools_25 = {};
  6013. "use strict";
  6014. Object.defineProperty(_$devTools_25, "__esModule", {
  6015. value: true
  6016. });
  6017. _$devTools_25["default"] = void 0;
  6018. var ___domObjects_25 = ___interopRequireDefault_25(_$domObjects_49);
  6019. /* removed: var _$domUtils_50 = require("@interactjs/utils/domUtils"); */;
  6020. var ___extend_25 = ___interopRequireDefault_25(_$extend_52);
  6021. var __is_25 = ___interopRequireWildcard_25(_$is_56);
  6022. var ___window_25 = ___interopRequireDefault_25(_$window_65);
  6023. function ___interopRequireWildcard_25(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  6024. function ___interopRequireDefault_25(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6025. function ___toConsumableArray_25(arr) { return ___arrayWithoutHoles_25(arr) || ___iterableToArray_25(arr) || ___nonIterableSpread_25(); }
  6026. function ___nonIterableSpread_25() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
  6027. function ___iterableToArray_25(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
  6028. function ___arrayWithoutHoles_25(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
  6029. var CheckName;
  6030. (function (CheckName) {
  6031. CheckName["touchAction"] = "";
  6032. CheckName["boxSizing"] = "";
  6033. CheckName["noListeners"] = "";
  6034. })(CheckName || (CheckName = {}));
  6035. var prefix = '[interact.js] ';
  6036. var links = {
  6037. touchAction: 'https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action',
  6038. boxSizing: 'https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing'
  6039. };
  6040. var isProduction = "production" === 'production'; // eslint-disable-next-line no-restricted-syntax
  6041. function __install_25(scope) {
  6042. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  6043. logger = _ref.logger;
  6044. var interactions = scope.interactions,
  6045. Interactable = scope.Interactable,
  6046. defaults = scope.defaults;
  6047. logger = logger || console;
  6048. interactions.signals.on('action-start', function (_ref2) {
  6049. var interaction = _ref2.interaction;
  6050. for (var _i = 0; _i < checks.length; _i++) {
  6051. var _ref3;
  6052. _ref3 = checks[_i];
  6053. var check = _ref3;
  6054. var options = interaction.interactable && interaction.interactable.options[interaction.prepared.name];
  6055. if (!(options && options.devTools && options.devTools.ignore[check.name]) && check.perform(interaction)) {
  6056. var _logger;
  6057. (_logger = logger).warn.apply(_logger, [prefix + check.text].concat(___toConsumableArray_25(check.getInfo(interaction))));
  6058. }
  6059. }
  6060. });
  6061. defaults.base.devTools = {
  6062. ignore: {}
  6063. };
  6064. Interactable.prototype.devTools = function (options) {
  6065. if (options) {
  6066. (0, ___extend_25["default"])(this.options.devTools, options);
  6067. return this;
  6068. }
  6069. return this.options.devTools;
  6070. };
  6071. }
  6072. var checks = [{
  6073. name: 'touchAction',
  6074. perform: function perform(_ref4) {
  6075. var element = _ref4.element;
  6076. return !parentHasStyle(element, 'touchAction', /pan-|pinch|none/);
  6077. },
  6078. getInfo: function getInfo(_ref5) {
  6079. var element = _ref5.element;
  6080. return [element, links.touchAction];
  6081. },
  6082. text: 'Consider adding CSS "touch-action: none" to this element\n'
  6083. }, {
  6084. name: 'boxSizing',
  6085. perform: function perform(interaction) {
  6086. var element = interaction.element;
  6087. return interaction.prepared.name === 'resize' && element instanceof ___domObjects_25["default"].HTMLElement && !hasStyle(element, 'boxSizing', /border-box/);
  6088. },
  6089. text: 'Consider adding CSS "box-sizing: border-box" to this resizable element',
  6090. getInfo: function getInfo(_ref6) {
  6091. var element = _ref6.element;
  6092. return [element, links.boxSizing];
  6093. }
  6094. }, {
  6095. name: 'noListeners',
  6096. perform: function perform(interaction) {
  6097. var actionName = interaction.prepared.name;
  6098. var moveListeners = interaction.interactable.events.types["".concat(actionName, "move")] || [];
  6099. return !moveListeners.length;
  6100. },
  6101. getInfo: function getInfo(interaction) {
  6102. return [interaction.prepared.name, interaction.interactable];
  6103. },
  6104. text: 'There are no listeners set for this action'
  6105. }];
  6106. function hasStyle(element, prop, styleRe) {
  6107. return styleRe.test(element.style[prop] || ___window_25["default"].window.getComputedStyle(element)[prop]);
  6108. }
  6109. function parentHasStyle(element, prop, styleRe) {
  6110. var parent = element;
  6111. while (__is_25.element(parent)) {
  6112. if (hasStyle(parent, prop, styleRe)) {
  6113. return true;
  6114. }
  6115. parent = (0, _$domUtils_50.parentNode)(parent);
  6116. }
  6117. return false;
  6118. }
  6119. var __id_25 = 'dev-tools';
  6120. var defaultExport = isProduction ? {
  6121. id: __id_25,
  6122. install: function install() {}
  6123. } : {
  6124. id: __id_25,
  6125. install: __install_25,
  6126. checks: checks,
  6127. CheckName: CheckName,
  6128. links: links,
  6129. prefix: prefix
  6130. };
  6131. var ___default_25 = defaultExport;
  6132. _$devTools_25["default"] = ___default_25;
  6133. var _$base_30 = {};
  6134. "use strict";
  6135. Object.defineProperty(_$base_30, "__esModule", {
  6136. value: true
  6137. });
  6138. _$base_30.startAll = startAll;
  6139. _$base_30.setAll = setAll;
  6140. _$base_30.prepareStates = prepareStates;
  6141. _$base_30.makeModifier = makeModifier;
  6142. _$base_30["default"] = void 0;
  6143. var ___extend_30 = ___interopRequireDefault_30(_$extend_52);
  6144. function ___interopRequireDefault_30(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6145. function ___slicedToArray_30(arr, i) { return ___arrayWithHoles_30(arr) || ___iterableToArrayLimit_30(arr, i) || ___nonIterableRest_30(); }
  6146. function ___nonIterableRest_30() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  6147. function ___iterableToArrayLimit_30(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  6148. function ___arrayWithHoles_30(arr) { if (Array.isArray(arr)) return arr; }
  6149. function __install_30(scope) {
  6150. var interactions = scope.interactions;
  6151. scope.defaults.perAction.modifiers = [];
  6152. scope.modifiers = {};
  6153. interactions.signals.on('new', function (_ref) {
  6154. var interaction = _ref.interaction;
  6155. interaction.modifiers = {
  6156. startOffset: {
  6157. left: 0,
  6158. right: 0,
  6159. top: 0,
  6160. bottom: 0
  6161. },
  6162. offsets: {},
  6163. states: null,
  6164. result: null,
  6165. endPrevented: false,
  6166. startDelta: null
  6167. };
  6168. });
  6169. interactions.signals.on('before-action-start', function (arg) {
  6170. __start_30(arg, arg.interaction.coords.start.page, scope.modifiers);
  6171. });
  6172. interactions.signals.on('action-resume', function (arg) {
  6173. stop(arg);
  6174. __start_30(arg, arg.interaction.coords.cur.page, scope.modifiers);
  6175. __beforeMove_30(arg);
  6176. });
  6177. interactions.signals.on('after-action-move', restoreCoords);
  6178. interactions.signals.on('before-action-move', __beforeMove_30);
  6179. interactions.signals.on('before-action-start', setCoords);
  6180. interactions.signals.on('after-action-start', restoreCoords);
  6181. interactions.signals.on('before-action-end', beforeEnd);
  6182. interactions.signals.on('stop', stop);
  6183. }
  6184. function __start_30(_ref2, pageCoords, registeredModifiers) {
  6185. var interaction = _ref2.interaction,
  6186. phase = _ref2.phase;
  6187. var interactable = interaction.interactable,
  6188. element = interaction.element;
  6189. var modifierList = getModifierList(interaction, registeredModifiers);
  6190. var states = prepareStates(modifierList);
  6191. var rect = (0, ___extend_30["default"])({}, interaction.rect);
  6192. if (!('width' in rect)) {
  6193. rect.width = rect.right - rect.left;
  6194. }
  6195. if (!('height' in rect)) {
  6196. rect.height = rect.bottom - rect.top;
  6197. }
  6198. var startOffset = getRectOffset(rect, pageCoords);
  6199. interaction.modifiers.startOffset = startOffset;
  6200. interaction.modifiers.startDelta = {
  6201. x: 0,
  6202. y: 0
  6203. };
  6204. var arg = {
  6205. interaction: interaction,
  6206. interactable: interactable,
  6207. element: element,
  6208. pageCoords: pageCoords,
  6209. phase: phase,
  6210. rect: rect,
  6211. startOffset: startOffset,
  6212. states: states,
  6213. preEnd: false,
  6214. requireEndOnly: false
  6215. };
  6216. interaction.modifiers.states = states;
  6217. interaction.modifiers.result = null;
  6218. startAll(arg);
  6219. arg.pageCoords = (0, ___extend_30["default"])({}, interaction.coords.start.page);
  6220. var result = interaction.modifiers.result = setAll(arg);
  6221. return result;
  6222. }
  6223. function startAll(arg) {
  6224. for (var _i = 0; _i < arg.states.length; _i++) {
  6225. var _ref3;
  6226. _ref3 = arg.states[_i];
  6227. var state = _ref3;
  6228. if (state.methods.start) {
  6229. arg.state = state;
  6230. state.methods.start(arg);
  6231. }
  6232. }
  6233. }
  6234. function setAll(arg) {
  6235. var interaction = arg.interaction,
  6236. _arg$modifiersState = arg.modifiersState,
  6237. modifiersState = _arg$modifiersState === void 0 ? interaction.modifiers : _arg$modifiersState,
  6238. _arg$prevCoords = arg.prevCoords,
  6239. prevCoords = _arg$prevCoords === void 0 ? modifiersState.result ? modifiersState.result.coords : interaction.coords.prev.page : _arg$prevCoords,
  6240. phase = arg.phase,
  6241. preEnd = arg.preEnd,
  6242. requireEndOnly = arg.requireEndOnly,
  6243. rect = arg.rect,
  6244. skipModifiers = arg.skipModifiers;
  6245. var states = skipModifiers ? arg.states.slice(skipModifiers) : arg.states;
  6246. arg.coords = (0, ___extend_30["default"])({}, arg.pageCoords);
  6247. arg.rect = (0, ___extend_30["default"])({}, rect);
  6248. var result = {
  6249. delta: {
  6250. x: 0,
  6251. y: 0
  6252. },
  6253. rectDelta: {
  6254. left: 0,
  6255. right: 0,
  6256. top: 0,
  6257. bottom: 0
  6258. },
  6259. coords: arg.coords,
  6260. changed: true
  6261. };
  6262. for (var _i2 = 0; _i2 < states.length; _i2++) {
  6263. var _ref4;
  6264. _ref4 = states[_i2];
  6265. var state = _ref4;
  6266. var options = state.options;
  6267. if (!state.methods.set || !shouldDo(options, preEnd, requireEndOnly, phase)) {
  6268. continue;
  6269. }
  6270. arg.state = state;
  6271. state.methods.set(arg);
  6272. }
  6273. result.delta.x = arg.coords.x - arg.pageCoords.x;
  6274. result.delta.y = arg.coords.y - arg.pageCoords.y;
  6275. var rectChanged = false;
  6276. if (rect) {
  6277. result.rectDelta.left = arg.rect.left - rect.left;
  6278. result.rectDelta.right = arg.rect.right - rect.right;
  6279. result.rectDelta.top = arg.rect.top - rect.top;
  6280. result.rectDelta.bottom = arg.rect.bottom - rect.bottom;
  6281. rectChanged = result.rectDelta.left !== 0 || result.rectDelta.right !== 0 || result.rectDelta.top !== 0 || result.rectDelta.bottom !== 0;
  6282. }
  6283. result.changed = prevCoords.x !== result.coords.x || prevCoords.y !== result.coords.y || rectChanged;
  6284. return result;
  6285. }
  6286. function __beforeMove_30(arg) {
  6287. var interaction = arg.interaction,
  6288. phase = arg.phase,
  6289. preEnd = arg.preEnd,
  6290. skipModifiers = arg.skipModifiers;
  6291. var interactable = interaction.interactable,
  6292. element = interaction.element;
  6293. var modifierResult = setAll({
  6294. interaction: interaction,
  6295. interactable: interactable,
  6296. element: element,
  6297. preEnd: preEnd,
  6298. phase: phase,
  6299. pageCoords: interaction.coords.cur.page,
  6300. rect: interaction.rect,
  6301. states: interaction.modifiers.states,
  6302. requireEndOnly: false,
  6303. skipModifiers: skipModifiers
  6304. });
  6305. interaction.modifiers.result = modifierResult; // don't fire an action move if a modifier would keep the event in the same
  6306. // cordinates as before
  6307. if (!modifierResult.changed && interaction.interacting()) {
  6308. return false;
  6309. }
  6310. setCoords(arg);
  6311. }
  6312. function beforeEnd(arg) {
  6313. var interaction = arg.interaction,
  6314. event = arg.event,
  6315. noPreEnd = arg.noPreEnd;
  6316. var states = interaction.modifiers.states;
  6317. if (noPreEnd || !states || !states.length) {
  6318. return;
  6319. }
  6320. var didPreEnd = false;
  6321. for (var _i3 = 0; _i3 < states.length; _i3++) {
  6322. var _ref5;
  6323. _ref5 = states[_i3];
  6324. var state = _ref5;
  6325. arg.state = state;
  6326. var options = state.options,
  6327. methods = state.methods;
  6328. var endResult = methods.beforeEnd && methods.beforeEnd(arg);
  6329. if (endResult === false) {
  6330. interaction.modifiers.endPrevented = true;
  6331. return false;
  6332. } // if the endOnly option is true for any modifier
  6333. if (!didPreEnd && shouldDo(options, true, true)) {
  6334. // fire a move event at the modified coordinates
  6335. interaction.move({
  6336. event: event,
  6337. preEnd: true
  6338. });
  6339. didPreEnd = true;
  6340. }
  6341. }
  6342. }
  6343. function stop(arg) {
  6344. var interaction = arg.interaction;
  6345. var states = interaction.modifiers.states;
  6346. if (!states || !states.length) {
  6347. return;
  6348. }
  6349. var modifierArg = (0, ___extend_30["default"])({
  6350. states: states,
  6351. interactable: interaction.interactable,
  6352. element: interaction.element
  6353. }, arg);
  6354. restoreCoords(arg);
  6355. for (var _i4 = 0; _i4 < states.length; _i4++) {
  6356. var _ref6;
  6357. _ref6 = states[_i4];
  6358. var state = _ref6;
  6359. modifierArg.state = state;
  6360. if (state.methods.stop) {
  6361. state.methods.stop(modifierArg);
  6362. }
  6363. }
  6364. arg.interaction.modifiers.states = null;
  6365. arg.interaction.modifiers.endPrevented = false;
  6366. }
  6367. function getModifierList(interaction, registeredModifiers) {
  6368. var actionOptions = interaction.interactable.options[interaction.prepared.name];
  6369. var actionModifiers = actionOptions.modifiers;
  6370. if (actionModifiers && actionModifiers.length) {
  6371. return actionModifiers.filter(function (modifier) {
  6372. return !modifier.options || modifier.options.enabled !== false;
  6373. }).map(function (modifier) {
  6374. if (!modifier.methods && modifier.type) {
  6375. return registeredModifiers[modifier.type](modifier);
  6376. }
  6377. return modifier;
  6378. });
  6379. }
  6380. return ['snap', 'snapSize', 'snapEdges', 'restrict', 'restrictEdges', 'restrictSize'].map(function (type) {
  6381. var options = actionOptions[type];
  6382. return options && options.enabled && {
  6383. options: options,
  6384. methods: options._methods
  6385. };
  6386. }).filter(function (m) {
  6387. return !!m;
  6388. });
  6389. }
  6390. function prepareStates(modifierList) {
  6391. var states = [];
  6392. for (var index = 0; index < modifierList.length; index++) {
  6393. var _modifierList$index = modifierList[index],
  6394. options = _modifierList$index.options,
  6395. methods = _modifierList$index.methods,
  6396. name = _modifierList$index.name;
  6397. if (options && options.enabled === false) {
  6398. continue;
  6399. }
  6400. var state = {
  6401. options: options,
  6402. methods: methods,
  6403. index: index,
  6404. name: name
  6405. };
  6406. states.push(state);
  6407. }
  6408. return states;
  6409. }
  6410. function setCoords(arg) {
  6411. var interaction = arg.interaction,
  6412. phase = arg.phase;
  6413. var curCoords = arg.curCoords || interaction.coords.cur;
  6414. var startCoords = arg.startCoords || interaction.coords.start;
  6415. var _interaction$modifier = interaction.modifiers,
  6416. result = _interaction$modifier.result,
  6417. startDelta = _interaction$modifier.startDelta;
  6418. var curDelta = result.delta;
  6419. if (phase === 'start') {
  6420. (0, ___extend_30["default"])(interaction.modifiers.startDelta, result.delta);
  6421. }
  6422. var _arr = [[startCoords, startDelta], [curCoords, curDelta]];
  6423. for (var _i5 = 0; _i5 < _arr.length; _i5++) {
  6424. var _arr$_i = ___slicedToArray_30(_arr[_i5], 2),
  6425. coordsSet = _arr$_i[0],
  6426. delta = _arr$_i[1];
  6427. coordsSet.page.x += delta.x;
  6428. coordsSet.page.y += delta.y;
  6429. coordsSet.client.x += delta.x;
  6430. coordsSet.client.y += delta.y;
  6431. }
  6432. var rectDelta = interaction.modifiers.result.rectDelta;
  6433. var rect = arg.rect || interaction.rect;
  6434. rect.left += rectDelta.left;
  6435. rect.right += rectDelta.right;
  6436. rect.top += rectDelta.top;
  6437. rect.bottom += rectDelta.bottom;
  6438. rect.width = rect.right - rect.left;
  6439. rect.height = rect.bottom - rect.top;
  6440. }
  6441. function restoreCoords(_ref7) {
  6442. var _ref7$interaction = _ref7.interaction,
  6443. coords = _ref7$interaction.coords,
  6444. rect = _ref7$interaction.rect,
  6445. modifiers = _ref7$interaction.modifiers;
  6446. if (!modifiers.result) {
  6447. return;
  6448. }
  6449. var startDelta = modifiers.startDelta;
  6450. var _modifiers$result = modifiers.result,
  6451. curDelta = _modifiers$result.delta,
  6452. rectDelta = _modifiers$result.rectDelta;
  6453. var coordsAndDeltas = [[coords.start, startDelta], [coords.cur, curDelta]];
  6454. for (var _i6 = 0; _i6 < coordsAndDeltas.length; _i6++) {
  6455. var _coordsAndDeltas$_i = ___slicedToArray_30(coordsAndDeltas[_i6], 2),
  6456. coordsSet = _coordsAndDeltas$_i[0],
  6457. delta = _coordsAndDeltas$_i[1];
  6458. coordsSet.page.x -= delta.x;
  6459. coordsSet.page.y -= delta.y;
  6460. coordsSet.client.x -= delta.x;
  6461. coordsSet.client.y -= delta.y;
  6462. }
  6463. rect.left -= rectDelta.left;
  6464. rect.right -= rectDelta.right;
  6465. rect.top -= rectDelta.top;
  6466. rect.bottom -= rectDelta.bottom;
  6467. }
  6468. function shouldDo(options, preEnd, requireEndOnly, phase) {
  6469. return options ? options.enabled !== false && (preEnd || !options.endOnly) && (!requireEndOnly || options.endOnly || options.alwaysOnEnd) && (options.setStart || phase !== 'start') : !requireEndOnly;
  6470. }
  6471. function getRectOffset(rect, coords) {
  6472. return rect ? {
  6473. left: coords.x - rect.left,
  6474. top: coords.y - rect.top,
  6475. right: rect.right - coords.x,
  6476. bottom: rect.bottom - coords.y
  6477. } : {
  6478. left: 0,
  6479. top: 0,
  6480. right: 0,
  6481. bottom: 0
  6482. };
  6483. }
  6484. function makeModifier(module, name) {
  6485. var defaults = module.defaults;
  6486. var methods = {
  6487. start: module.start,
  6488. set: module.set,
  6489. beforeEnd: module.beforeEnd,
  6490. stop: module.stop
  6491. };
  6492. var modifier = function modifier(options) {
  6493. options = options || {};
  6494. options.enabled = options.enabled !== false; // add missing defaults to options
  6495. for (var prop in defaults) {
  6496. if (!(prop in options)) {
  6497. options[prop] = defaults[prop];
  6498. }
  6499. }
  6500. return {
  6501. options: options,
  6502. methods: methods,
  6503. name: name
  6504. };
  6505. };
  6506. if (typeof name === 'string') {
  6507. // for backwrads compatibility
  6508. modifier._defaults = defaults;
  6509. modifier._methods = methods;
  6510. }
  6511. return modifier;
  6512. }
  6513. var ___default_30 = {
  6514. id: 'modifiers/base',
  6515. install: __install_30,
  6516. startAll: startAll,
  6517. setAll: setAll,
  6518. prepareStates: prepareStates,
  6519. start: __start_30,
  6520. beforeMove: __beforeMove_30,
  6521. beforeEnd: beforeEnd,
  6522. stop: stop,
  6523. shouldDo: shouldDo,
  6524. getModifierList: getModifierList,
  6525. getRectOffset: getRectOffset,
  6526. makeModifier: makeModifier
  6527. };
  6528. _$base_30["default"] = ___default_30;
  6529. var _$inertia_26 = {};
  6530. "use strict";
  6531. Object.defineProperty(_$inertia_26, "__esModule", {
  6532. value: true
  6533. });
  6534. _$inertia_26["default"] = void 0;
  6535. /* removed: var _$InteractEvent_15 = require("@interactjs/core/InteractEvent"); */;
  6536. var ___base_26 = ___interopRequireDefault_26(_$base_30);
  6537. var __utils_26 = ___interopRequireWildcard_26(_$utils_55);
  6538. var ___raf_26 = ___interopRequireDefault_26(_$raf_61);
  6539. function ___interopRequireWildcard_26(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  6540. function ___interopRequireDefault_26(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6541. _$InteractEvent_15.EventPhase.Resume = 'resume';
  6542. _$InteractEvent_15.EventPhase.InertiaStart = 'inertiastart';
  6543. function __install_26(scope) {
  6544. var interactions = scope.interactions,
  6545. defaults = scope.defaults;
  6546. interactions.signals.on('new', function (_ref) {
  6547. var interaction = _ref.interaction;
  6548. interaction.inertia = {
  6549. active: false,
  6550. smoothEnd: false,
  6551. allowResume: false,
  6552. upCoords: {},
  6553. timeout: null
  6554. };
  6555. }); // FIXME proper signal typing
  6556. interactions.signals.on('before-action-end', function (arg) {
  6557. return release(arg, scope);
  6558. });
  6559. interactions.signals.on('down', function (arg) {
  6560. return resume(arg, scope);
  6561. });
  6562. interactions.signals.on('stop', function (arg) {
  6563. return __stop_26(arg);
  6564. });
  6565. defaults.perAction.inertia = {
  6566. enabled: false,
  6567. resistance: 10,
  6568. minSpeed: 100,
  6569. endSpeed: 10,
  6570. allowResume: true,
  6571. smoothEndDuration: 300
  6572. };
  6573. scope.usePlugin(___base_26["default"]);
  6574. }
  6575. function resume(_ref2, scope) {
  6576. var interaction = _ref2.interaction,
  6577. event = _ref2.event,
  6578. pointer = _ref2.pointer,
  6579. eventTarget = _ref2.eventTarget;
  6580. var state = interaction.inertia; // Check if the down event hits the current inertia target
  6581. if (state.active) {
  6582. var element = eventTarget; // climb up the DOM tree from the event target
  6583. while (__utils_26.is.element(element)) {
  6584. // if interaction element is the current inertia target element
  6585. if (element === interaction.element) {
  6586. // stop inertia
  6587. ___raf_26["default"].cancel(state.timeout);
  6588. state.active = false;
  6589. interaction.simulation = null; // update pointers to the down event's coordinates
  6590. interaction.updatePointer(pointer, event, eventTarget, true);
  6591. __utils_26.pointer.setCoords(interaction.coords.cur, interaction.pointers.map(function (p) {
  6592. return p.pointer;
  6593. }), interaction._now()); // fire appropriate signals
  6594. var signalArg = {
  6595. interaction: interaction
  6596. };
  6597. scope.interactions.signals.fire('action-resume', signalArg); // fire a reume event
  6598. var resumeEvent = new scope.InteractEvent(interaction, event, interaction.prepared.name, _$InteractEvent_15.EventPhase.Resume, interaction.element);
  6599. interaction._fireEvent(resumeEvent);
  6600. __utils_26.pointer.copyCoords(interaction.coords.prev, interaction.coords.cur);
  6601. break;
  6602. }
  6603. element = __utils_26.dom.parentNode(element);
  6604. }
  6605. }
  6606. }
  6607. function release(_ref3, scope) {
  6608. var interaction = _ref3.interaction,
  6609. event = _ref3.event,
  6610. noPreEnd = _ref3.noPreEnd;
  6611. var state = interaction.inertia;
  6612. if (!interaction.interacting() || interaction.simulation && interaction.simulation.active || noPreEnd) {
  6613. return null;
  6614. }
  6615. var options = __getOptions_26(interaction);
  6616. var now = interaction._now();
  6617. var velocityClient = interaction.coords.velocity.client;
  6618. var pointerSpeed = __utils_26.hypot(velocityClient.x, velocityClient.y);
  6619. var smoothEnd = false;
  6620. var modifierResult; // check if inertia should be started
  6621. var inertiaPossible = options && options.enabled && interaction.prepared.name !== 'gesture' && event !== state.startEvent;
  6622. var inertia = inertiaPossible && now - interaction.coords.cur.timeStamp < 50 && pointerSpeed > options.minSpeed && pointerSpeed > options.endSpeed;
  6623. var modifierArg = {
  6624. interaction: interaction,
  6625. pageCoords: __utils_26.extend({}, interaction.coords.cur.page),
  6626. states: inertiaPossible && interaction.modifiers.states.map(function (modifierStatus) {
  6627. return __utils_26.extend({}, modifierStatus);
  6628. }),
  6629. preEnd: true,
  6630. prevCoords: undefined,
  6631. requireEndOnly: null
  6632. }; // smoothEnd
  6633. if (inertiaPossible && !inertia) {
  6634. modifierArg.prevCoords = interaction.prevEvent.page;
  6635. modifierArg.requireEndOnly = false;
  6636. modifierResult = ___base_26["default"].setAll(modifierArg);
  6637. if (modifierResult.changed) {
  6638. smoothEnd = true;
  6639. }
  6640. }
  6641. if (!(inertia || smoothEnd)) {
  6642. return null;
  6643. }
  6644. __utils_26.pointer.copyCoords(state.upCoords, interaction.coords.cur);
  6645. interaction.pointers[0].pointer = state.startEvent = new scope.InteractEvent(interaction, event, // FIXME add proper typing Action.name
  6646. interaction.prepared.name, _$InteractEvent_15.EventPhase.InertiaStart, interaction.element);
  6647. state.t0 = now;
  6648. state.active = true;
  6649. state.allowResume = options.allowResume;
  6650. interaction.simulation = state;
  6651. interaction.interactable.fire(state.startEvent);
  6652. if (inertia) {
  6653. state.vx0 = interaction.coords.velocity.client.x;
  6654. state.vy0 = interaction.coords.velocity.client.y;
  6655. state.v0 = pointerSpeed;
  6656. calcInertia(interaction, state);
  6657. __utils_26.extend(modifierArg.pageCoords, interaction.coords.cur.page);
  6658. modifierArg.pageCoords.x += state.xe;
  6659. modifierArg.pageCoords.y += state.ye;
  6660. modifierArg.prevCoords = undefined;
  6661. modifierArg.requireEndOnly = true;
  6662. modifierResult = ___base_26["default"].setAll(modifierArg);
  6663. state.modifiedXe += modifierResult.delta.x;
  6664. state.modifiedYe += modifierResult.delta.y;
  6665. state.timeout = ___raf_26["default"].request(function () {
  6666. return inertiaTick(interaction);
  6667. });
  6668. } else {
  6669. state.smoothEnd = true;
  6670. state.xe = modifierResult.delta.x;
  6671. state.ye = modifierResult.delta.y;
  6672. state.sx = state.sy = 0;
  6673. state.timeout = ___raf_26["default"].request(function () {
  6674. return smothEndTick(interaction);
  6675. });
  6676. }
  6677. return false;
  6678. }
  6679. function __stop_26(_ref4) {
  6680. var interaction = _ref4.interaction;
  6681. var state = interaction.inertia;
  6682. if (state.active) {
  6683. ___raf_26["default"].cancel(state.timeout);
  6684. state.active = false;
  6685. interaction.simulation = null;
  6686. }
  6687. }
  6688. function calcInertia(interaction, state) {
  6689. var options = __getOptions_26(interaction);
  6690. var lambda = options.resistance;
  6691. var inertiaDur = -Math.log(options.endSpeed / state.v0) / lambda;
  6692. state.x0 = interaction.prevEvent.page.x;
  6693. state.y0 = interaction.prevEvent.page.y;
  6694. state.t0 = state.startEvent.timeStamp / 1000;
  6695. state.sx = state.sy = 0;
  6696. state.modifiedXe = state.xe = (state.vx0 - inertiaDur) / lambda;
  6697. state.modifiedYe = state.ye = (state.vy0 - inertiaDur) / lambda;
  6698. state.te = inertiaDur;
  6699. state.lambda_v0 = lambda / state.v0;
  6700. state.one_ve_v0 = 1 - options.endSpeed / state.v0;
  6701. }
  6702. function inertiaTick(interaction) {
  6703. updateInertiaCoords(interaction);
  6704. __utils_26.pointer.setCoordDeltas(interaction.coords.delta, interaction.coords.prev, interaction.coords.cur);
  6705. __utils_26.pointer.setCoordVelocity(interaction.coords.velocity, interaction.coords.delta);
  6706. var state = interaction.inertia;
  6707. var options = __getOptions_26(interaction);
  6708. var lambda = options.resistance;
  6709. var t = interaction._now() / 1000 - state.t0;
  6710. if (t < state.te) {
  6711. var progress = 1 - (Math.exp(-lambda * t) - state.lambda_v0) / state.one_ve_v0;
  6712. if (state.modifiedXe === state.xe && state.modifiedYe === state.ye) {
  6713. state.sx = state.xe * progress;
  6714. state.sy = state.ye * progress;
  6715. } else {
  6716. var quadPoint = __utils_26.getQuadraticCurvePoint(0, 0, state.xe, state.ye, state.modifiedXe, state.modifiedYe, progress);
  6717. state.sx = quadPoint.x;
  6718. state.sy = quadPoint.y;
  6719. }
  6720. interaction.move();
  6721. state.timeout = ___raf_26["default"].request(function () {
  6722. return inertiaTick(interaction);
  6723. });
  6724. } else {
  6725. state.sx = state.modifiedXe;
  6726. state.sy = state.modifiedYe;
  6727. interaction.move();
  6728. interaction.end(state.startEvent);
  6729. state.active = false;
  6730. interaction.simulation = null;
  6731. }
  6732. __utils_26.pointer.copyCoords(interaction.coords.prev, interaction.coords.cur);
  6733. }
  6734. function smothEndTick(interaction) {
  6735. updateInertiaCoords(interaction);
  6736. var state = interaction.inertia;
  6737. var t = interaction._now() - state.t0;
  6738. var _getOptions = __getOptions_26(interaction),
  6739. duration = _getOptions.smoothEndDuration;
  6740. if (t < duration) {
  6741. state.sx = __utils_26.easeOutQuad(t, 0, state.xe, duration);
  6742. state.sy = __utils_26.easeOutQuad(t, 0, state.ye, duration);
  6743. interaction.move();
  6744. state.timeout = ___raf_26["default"].request(function () {
  6745. return smothEndTick(interaction);
  6746. });
  6747. } else {
  6748. state.sx = state.xe;
  6749. state.sy = state.ye;
  6750. interaction.move();
  6751. interaction.end(state.startEvent);
  6752. state.smoothEnd = state.active = false;
  6753. interaction.simulation = null;
  6754. }
  6755. }
  6756. function updateInertiaCoords(interaction) {
  6757. var state = interaction.inertia; // return if inertia isn't running
  6758. if (!state.active) {
  6759. return;
  6760. }
  6761. var pageUp = state.upCoords.page;
  6762. var clientUp = state.upCoords.client;
  6763. __utils_26.pointer.setCoords(interaction.coords.cur, [{
  6764. pageX: pageUp.x + state.sx,
  6765. pageY: pageUp.y + state.sy,
  6766. clientX: clientUp.x + state.sx,
  6767. clientY: clientUp.y + state.sy
  6768. }], interaction._now());
  6769. }
  6770. function __getOptions_26(_ref5) {
  6771. var interactable = _ref5.interactable,
  6772. prepared = _ref5.prepared;
  6773. return interactable && interactable.options && prepared.name && interactable.options[prepared.name].inertia;
  6774. }
  6775. var ___default_26 = {
  6776. id: 'inertia',
  6777. install: __install_26,
  6778. calcInertia: calcInertia,
  6779. inertiaTick: inertiaTick,
  6780. smothEndTick: smothEndTick,
  6781. updateInertiaCoords: updateInertiaCoords
  6782. };
  6783. _$inertia_26["default"] = ___default_26;
  6784. var _$pointer_33 = {};
  6785. "use strict";
  6786. Object.defineProperty(_$pointer_33, "__esModule", {
  6787. value: true
  6788. });
  6789. _$pointer_33["default"] = void 0;
  6790. var __is_33 = ___interopRequireWildcard_33(_$is_56);
  6791. var ___rect_33 = ___interopRequireDefault_33(_$rect_62);
  6792. function ___interopRequireDefault_33(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6793. function ___interopRequireWildcard_33(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  6794. function __start_33(_ref) {
  6795. var rect = _ref.rect,
  6796. startOffset = _ref.startOffset,
  6797. state = _ref.state;
  6798. var options = state.options;
  6799. var elementRect = options.elementRect;
  6800. var offset = {};
  6801. if (rect && elementRect) {
  6802. offset.left = startOffset.left - rect.width * elementRect.left;
  6803. offset.top = startOffset.top - rect.height * elementRect.top;
  6804. offset.right = startOffset.right - rect.width * (1 - elementRect.right);
  6805. offset.bottom = startOffset.bottom - rect.height * (1 - elementRect.bottom);
  6806. } else {
  6807. offset.left = offset.top = offset.right = offset.bottom = 0;
  6808. }
  6809. state.offset = offset;
  6810. }
  6811. function set(_ref2) {
  6812. var coords = _ref2.coords,
  6813. interaction = _ref2.interaction,
  6814. state = _ref2.state;
  6815. var options = state.options,
  6816. offset = state.offset;
  6817. var restriction = getRestrictionRect(options.restriction, interaction, coords);
  6818. if (!restriction) {
  6819. return state;
  6820. }
  6821. var rect = restriction; // object is assumed to have
  6822. // x, y, width, height or
  6823. // left, top, right, bottom
  6824. if ('x' in restriction && 'y' in restriction) {
  6825. coords.x = Math.max(Math.min(rect.x + rect.width - offset.right, coords.x), rect.x + offset.left);
  6826. coords.y = Math.max(Math.min(rect.y + rect.height - offset.bottom, coords.y), rect.y + offset.top);
  6827. } else {
  6828. coords.x = Math.max(Math.min(rect.right - offset.right, coords.x), rect.left + offset.left);
  6829. coords.y = Math.max(Math.min(rect.bottom - offset.bottom, coords.y), rect.top + offset.top);
  6830. }
  6831. }
  6832. function getRestrictionRect(value, interaction, coords) {
  6833. if (__is_33.func(value)) {
  6834. return ___rect_33["default"].resolveRectLike(value, interaction.interactable, interaction.element, [coords.x, coords.y, interaction]);
  6835. } else {
  6836. return ___rect_33["default"].resolveRectLike(value, interaction.interactable, interaction.element);
  6837. }
  6838. }
  6839. var restrict = {
  6840. start: __start_33,
  6841. set: set,
  6842. getRestrictionRect: getRestrictionRect,
  6843. defaults: {
  6844. enabled: false,
  6845. restriction: null,
  6846. elementRect: null
  6847. }
  6848. };
  6849. var ___default_33 = restrict;
  6850. _$pointer_33["default"] = ___default_33;
  6851. var _$edges_32 = {};
  6852. "use strict";
  6853. Object.defineProperty(_$edges_32, "__esModule", {
  6854. value: true
  6855. });
  6856. _$edges_32["default"] = void 0;
  6857. var ___extend_32 = ___interopRequireDefault_32(_$extend_52);
  6858. var ___rect_32 = ___interopRequireDefault_32(_$rect_62);
  6859. var _pointer = ___interopRequireDefault_32(_$pointer_33);
  6860. function ___interopRequireDefault_32(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6861. // This module adds the options.resize.restrictEdges setting which sets min and
  6862. // max for the top, left, bottom and right edges of the target being resized.
  6863. //
  6864. // interact(target).resize({
  6865. // edges: { top: true, left: true },
  6866. // restrictEdges: {
  6867. // inner: { top: 200, left: 200, right: 400, bottom: 400 },
  6868. // outer: { top: 0, left: 0, right: 600, bottom: 600 },
  6869. // },
  6870. // })
  6871. var __getRestrictionRect_32 = _pointer["default"].getRestrictionRect;
  6872. var noInner = {
  6873. top: +Infinity,
  6874. left: +Infinity,
  6875. bottom: -Infinity,
  6876. right: -Infinity
  6877. };
  6878. var noOuter = {
  6879. top: -Infinity,
  6880. left: -Infinity,
  6881. bottom: +Infinity,
  6882. right: +Infinity
  6883. };
  6884. function __start_32(_ref) {
  6885. var interaction = _ref.interaction,
  6886. state = _ref.state;
  6887. var options = state.options;
  6888. var startOffset = interaction.modifiers.startOffset;
  6889. var offset;
  6890. if (options) {
  6891. var offsetRect = __getRestrictionRect_32(options.offset, interaction, interaction.coords.start.page);
  6892. offset = ___rect_32["default"].rectToXY(offsetRect);
  6893. }
  6894. offset = offset || {
  6895. x: 0,
  6896. y: 0
  6897. };
  6898. state.offset = {
  6899. top: offset.y + startOffset.top,
  6900. left: offset.x + startOffset.left,
  6901. bottom: offset.y - startOffset.bottom,
  6902. right: offset.x - startOffset.right
  6903. };
  6904. }
  6905. function __set_32(_ref2) {
  6906. var coords = _ref2.coords,
  6907. interaction = _ref2.interaction,
  6908. state = _ref2.state;
  6909. var offset = state.offset,
  6910. options = state.options;
  6911. var edges = interaction.prepared._linkedEdges || interaction.prepared.edges;
  6912. if (!edges) {
  6913. return;
  6914. }
  6915. var page = (0, ___extend_32["default"])({}, coords);
  6916. var inner = __getRestrictionRect_32(options.inner, interaction, page) || {};
  6917. var outer = __getRestrictionRect_32(options.outer, interaction, page) || {};
  6918. fixRect(inner, noInner);
  6919. fixRect(outer, noOuter);
  6920. if (edges.top) {
  6921. coords.y = Math.min(Math.max(outer.top + offset.top, page.y), inner.top + offset.top);
  6922. } else if (edges.bottom) {
  6923. coords.y = Math.max(Math.min(outer.bottom + offset.bottom, page.y), inner.bottom + offset.bottom);
  6924. }
  6925. if (edges.left) {
  6926. coords.x = Math.min(Math.max(outer.left + offset.left, page.x), inner.left + offset.left);
  6927. } else if (edges.right) {
  6928. coords.x = Math.max(Math.min(outer.right + offset.right, page.x), inner.right + offset.right);
  6929. }
  6930. }
  6931. function fixRect(rect, defaults) {
  6932. var _arr = ['top', 'left', 'bottom', 'right'];
  6933. for (var _i = 0; _i < _arr.length; _i++) {
  6934. var edge = _arr[_i];
  6935. if (!(edge in rect)) {
  6936. rect[edge] = defaults[edge];
  6937. }
  6938. }
  6939. return rect;
  6940. }
  6941. var restrictEdges = {
  6942. noInner: noInner,
  6943. noOuter: noOuter,
  6944. getRestrictionRect: __getRestrictionRect_32,
  6945. start: __start_32,
  6946. set: __set_32,
  6947. defaults: {
  6948. enabled: false,
  6949. inner: null,
  6950. outer: null,
  6951. offset: null
  6952. }
  6953. };
  6954. var ___default_32 = restrictEdges;
  6955. _$edges_32["default"] = ___default_32;
  6956. var _$size_34 = {};
  6957. "use strict";
  6958. Object.defineProperty(_$size_34, "__esModule", {
  6959. value: true
  6960. });
  6961. _$size_34["default"] = void 0;
  6962. var ___extend_34 = ___interopRequireDefault_34(_$extend_52);
  6963. var ___rect_34 = ___interopRequireDefault_34(_$rect_62);
  6964. var _edges = ___interopRequireDefault_34(_$edges_32);
  6965. function ___interopRequireDefault_34(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  6966. // This module adds the options.resize.restrictSize setting which sets min and
  6967. // max width and height for the target being resized.
  6968. //
  6969. // interact(target).resize({
  6970. // edges: { top: true, left: true },
  6971. // restrictSize: {
  6972. // min: { width: -600, height: -600 },
  6973. // max: { width: 600, height: 600 },
  6974. // },
  6975. // })
  6976. var noMin = {
  6977. width: -Infinity,
  6978. height: -Infinity
  6979. };
  6980. var noMax = {
  6981. width: +Infinity,
  6982. height: +Infinity
  6983. };
  6984. function __start_34(arg) {
  6985. return _edges["default"].start(arg);
  6986. }
  6987. function __set_34(arg) {
  6988. var interaction = arg.interaction,
  6989. state = arg.state;
  6990. var options = state.options;
  6991. var edges = interaction.prepared.linkedEdges || interaction.prepared.edges;
  6992. if (!edges) {
  6993. return;
  6994. }
  6995. var rect = ___rect_34["default"].xywhToTlbr(interaction.resizeRects.inverted);
  6996. var minSize = ___rect_34["default"].tlbrToXywh(_edges["default"].getRestrictionRect(options.min, interaction)) || noMin;
  6997. var maxSize = ___rect_34["default"].tlbrToXywh(_edges["default"].getRestrictionRect(options.max, interaction)) || noMax;
  6998. state.options = {
  6999. enabled: options.enabled,
  7000. endOnly: options.endOnly,
  7001. inner: (0, ___extend_34["default"])({}, _edges["default"].noInner),
  7002. outer: (0, ___extend_34["default"])({}, _edges["default"].noOuter)
  7003. };
  7004. if (edges.top) {
  7005. state.options.inner.top = rect.bottom - minSize.height;
  7006. state.options.outer.top = rect.bottom - maxSize.height;
  7007. } else if (edges.bottom) {
  7008. state.options.inner.bottom = rect.top + minSize.height;
  7009. state.options.outer.bottom = rect.top + maxSize.height;
  7010. }
  7011. if (edges.left) {
  7012. state.options.inner.left = rect.right - minSize.width;
  7013. state.options.outer.left = rect.right - maxSize.width;
  7014. } else if (edges.right) {
  7015. state.options.inner.right = rect.left + minSize.width;
  7016. state.options.outer.right = rect.left + maxSize.width;
  7017. }
  7018. _edges["default"].set(arg);
  7019. state.options = options;
  7020. }
  7021. var restrictSize = {
  7022. start: __start_34,
  7023. set: __set_34,
  7024. defaults: {
  7025. enabled: false,
  7026. min: null,
  7027. max: null
  7028. }
  7029. };
  7030. var ___default_34 = restrictSize;
  7031. _$size_34["default"] = ___default_34;
  7032. var _$pointer_36 = {};
  7033. "use strict";
  7034. Object.defineProperty(_$pointer_36, "__esModule", {
  7035. value: true
  7036. });
  7037. _$pointer_36["default"] = void 0;
  7038. var __utils_36 = ___interopRequireWildcard_36(_$utils_55);
  7039. function ___interopRequireWildcard_36(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  7040. function __start_36(arg) {
  7041. var interaction = arg.interaction,
  7042. interactable = arg.interactable,
  7043. element = arg.element,
  7044. rect = arg.rect,
  7045. state = arg.state,
  7046. startOffset = arg.startOffset;
  7047. var options = state.options;
  7048. var offsets = [];
  7049. var origin = options.offsetWithOrigin ? getOrigin(arg) : {
  7050. x: 0,
  7051. y: 0
  7052. };
  7053. var snapOffset;
  7054. if (options.offset === 'startCoords') {
  7055. snapOffset = {
  7056. x: interaction.coords.start.page.x,
  7057. y: interaction.coords.start.page.y
  7058. };
  7059. } else {
  7060. var offsetRect = __utils_36.rect.resolveRectLike(options.offset, interactable, element, [interaction]);
  7061. snapOffset = __utils_36.rect.rectToXY(offsetRect) || {
  7062. x: 0,
  7063. y: 0
  7064. };
  7065. snapOffset.x += origin.x;
  7066. snapOffset.y += origin.y;
  7067. }
  7068. var relativePoints = options.relativePoints || [];
  7069. if (rect && options.relativePoints && options.relativePoints.length) {
  7070. for (var index = 0; index < relativePoints.length; index++) {
  7071. var relativePoint = relativePoints[index];
  7072. offsets.push({
  7073. index: index,
  7074. relativePoint: relativePoint,
  7075. x: startOffset.left - rect.width * relativePoint.x + snapOffset.x,
  7076. y: startOffset.top - rect.height * relativePoint.y + snapOffset.y
  7077. });
  7078. }
  7079. } else {
  7080. offsets.push(__utils_36.extend({
  7081. index: 0,
  7082. relativePoint: null
  7083. }, snapOffset));
  7084. }
  7085. state.offsets = offsets;
  7086. }
  7087. function __set_36(arg) {
  7088. var interaction = arg.interaction,
  7089. coords = arg.coords,
  7090. state = arg.state;
  7091. var options = state.options,
  7092. offsets = state.offsets;
  7093. var origin = __utils_36.getOriginXY(interaction.interactable, interaction.element, interaction.prepared.name);
  7094. var page = __utils_36.extend({}, coords);
  7095. var targets = [];
  7096. var target;
  7097. if (!options.offsetWithOrigin) {
  7098. page.x -= origin.x;
  7099. page.y -= origin.y;
  7100. }
  7101. state.realX = page.x;
  7102. state.realY = page.y;
  7103. for (var _i = 0; _i < offsets.length; _i++) {
  7104. var _ref;
  7105. _ref = offsets[_i];
  7106. var offset = _ref;
  7107. var relativeX = page.x - offset.x;
  7108. var relativeY = page.y - offset.y;
  7109. for (var index = 0, _len = options.targets.length; index < _len; index++) {
  7110. var snapTarget = options.targets[index];
  7111. if (__utils_36.is.func(snapTarget)) {
  7112. target = snapTarget(relativeX, relativeY, interaction, offset, index);
  7113. } else {
  7114. target = snapTarget;
  7115. }
  7116. if (!target) {
  7117. continue;
  7118. }
  7119. targets.push({
  7120. x: (__utils_36.is.number(target.x) ? target.x : relativeX) + offset.x,
  7121. y: (__utils_36.is.number(target.y) ? target.y : relativeY) + offset.y,
  7122. range: __utils_36.is.number(target.range) ? target.range : options.range
  7123. });
  7124. }
  7125. }
  7126. var closest = {
  7127. target: null,
  7128. inRange: false,
  7129. distance: 0,
  7130. range: 0,
  7131. dx: 0,
  7132. dy: 0
  7133. };
  7134. for (var i = 0, len = targets.length; i < len; i++) {
  7135. target = targets[i];
  7136. var range = target.range;
  7137. var dx = target.x - page.x;
  7138. var dy = target.y - page.y;
  7139. var distance = __utils_36.hypot(dx, dy);
  7140. var inRange = distance <= range; // Infinite targets count as being out of range
  7141. // compared to non infinite ones that are in range
  7142. if (range === Infinity && closest.inRange && closest.range !== Infinity) {
  7143. inRange = false;
  7144. }
  7145. if (!closest.target || (inRange // is the closest target in range?
  7146. ? closest.inRange && range !== Infinity // the pointer is relatively deeper in this target
  7147. ? distance / range < closest.distance / closest.range // this target has Infinite range and the closest doesn't
  7148. : range === Infinity && closest.range !== Infinity || // OR this target is closer that the previous closest
  7149. distance < closest.distance : // The other is not in range and the pointer is closer to this target
  7150. !closest.inRange && distance < closest.distance)) {
  7151. closest.target = target;
  7152. closest.distance = distance;
  7153. closest.range = range;
  7154. closest.inRange = inRange;
  7155. closest.dx = dx;
  7156. closest.dy = dy;
  7157. state.range = range;
  7158. }
  7159. }
  7160. if (closest.inRange) {
  7161. coords.x = closest.target.x;
  7162. coords.y = closest.target.y;
  7163. }
  7164. state.closest = closest;
  7165. }
  7166. function getOrigin(arg) {
  7167. var optionsOrigin = __utils_36.rect.rectToXY(__utils_36.rect.resolveRectLike(arg.state.options.origin));
  7168. var origin = optionsOrigin || __utils_36.getOriginXY(arg.interactable, arg.interaction.element, arg.interaction.prepared.name);
  7169. return origin;
  7170. }
  7171. var snap = {
  7172. start: __start_36,
  7173. set: __set_36,
  7174. defaults: {
  7175. enabled: false,
  7176. range: Infinity,
  7177. targets: null,
  7178. offset: null,
  7179. offsetWithOrigin: true,
  7180. relativePoints: null
  7181. }
  7182. };
  7183. var ___default_36 = snap;
  7184. _$pointer_36["default"] = ___default_36;
  7185. var _$size_37 = {};
  7186. "use strict";
  7187. Object.defineProperty(_$size_37, "__esModule", {
  7188. value: true
  7189. });
  7190. _$size_37["default"] = void 0;
  7191. var ___extend_37 = ___interopRequireDefault_37(_$extend_52);
  7192. var __is_37 = ___interopRequireWildcard_37(_$is_56);
  7193. var ___pointer_37 = ___interopRequireDefault_37(_$pointer_36);
  7194. function ___interopRequireWildcard_37(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  7195. function ___interopRequireDefault_37(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7196. function ___slicedToArray_37(arr, i) { return ___arrayWithHoles_37(arr) || ___iterableToArrayLimit_37(arr, i) || ___nonIterableRest_37(); }
  7197. function ___nonIterableRest_37() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  7198. function ___iterableToArrayLimit_37(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  7199. function ___arrayWithHoles_37(arr) { if (Array.isArray(arr)) return arr; }
  7200. function __start_37(arg) {
  7201. var interaction = arg.interaction,
  7202. state = arg.state;
  7203. var options = state.options;
  7204. var edges = interaction.prepared.edges;
  7205. if (!edges) {
  7206. return null;
  7207. }
  7208. arg.state = {
  7209. options: {
  7210. relativePoints: [{
  7211. x: edges.left ? 0 : 1,
  7212. y: edges.top ? 0 : 1
  7213. }],
  7214. origin: {
  7215. x: 0,
  7216. y: 0
  7217. },
  7218. offset: options.offset || 'self',
  7219. range: options.range
  7220. }
  7221. };
  7222. state.targetFields = state.targetFields || [['width', 'height'], ['x', 'y']];
  7223. ___pointer_37["default"].start(arg);
  7224. state.offsets = arg.state.offsets;
  7225. arg.state = state;
  7226. }
  7227. function __set_37(arg) {
  7228. var interaction = arg.interaction,
  7229. state = arg.state,
  7230. coords = arg.coords;
  7231. var options = state.options,
  7232. offsets = state.offsets;
  7233. var relative = {
  7234. x: coords.x - offsets[0].x,
  7235. y: coords.y - offsets[0].y
  7236. };
  7237. state.options = (0, ___extend_37["default"])({}, options);
  7238. state.options.targets = [];
  7239. for (var _i = 0; _i < (options.targets || []).length; _i++) {
  7240. var _ref;
  7241. _ref = (options.targets || [])[_i];
  7242. var snapTarget = _ref;
  7243. var target = void 0;
  7244. if (__is_37.func(snapTarget)) {
  7245. target = snapTarget(relative.x, relative.y, interaction);
  7246. } else {
  7247. target = snapTarget;
  7248. }
  7249. if (!target) {
  7250. continue;
  7251. }
  7252. for (var _i2 = 0; _i2 < state.targetFields.length; _i2++) {
  7253. var _ref2;
  7254. _ref2 = state.targetFields[_i2];
  7255. var _ref3 = _ref2,
  7256. _ref4 = ___slicedToArray_37(_ref3, 2),
  7257. xField = _ref4[0],
  7258. yField = _ref4[1];
  7259. if (xField in target || yField in target) {
  7260. target.x = target[xField];
  7261. target.y = target[yField];
  7262. break;
  7263. }
  7264. }
  7265. state.options.targets.push(target);
  7266. }
  7267. ___pointer_37["default"].set(arg);
  7268. state.options = options;
  7269. }
  7270. var snapSize = {
  7271. start: __start_37,
  7272. set: __set_37,
  7273. defaults: {
  7274. enabled: false,
  7275. range: Infinity,
  7276. targets: null,
  7277. offset: null
  7278. }
  7279. };
  7280. var ___default_37 = snapSize;
  7281. _$size_37["default"] = ___default_37;
  7282. var _$edges_35 = {};
  7283. "use strict";
  7284. Object.defineProperty(_$edges_35, "__esModule", {
  7285. value: true
  7286. });
  7287. _$edges_35["default"] = void 0;
  7288. var ___clone_35 = ___interopRequireDefault_35(_$clone_48);
  7289. var ___extend_35 = ___interopRequireDefault_35(_$extend_52);
  7290. var _size = ___interopRequireDefault_35(_$size_37);
  7291. function ___interopRequireDefault_35(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7292. /**
  7293. * @module modifiers/snapEdges
  7294. *
  7295. * @description
  7296. * This module allows snapping of the edges of targets during resize
  7297. * interactions.
  7298. *
  7299. * @example
  7300. * interact(target).resizable({
  7301. * snapEdges: {
  7302. * targets: [interact.snappers.grid({ x: 100, y: 50 })],
  7303. * },
  7304. * })
  7305. *
  7306. * interact(target).resizable({
  7307. * snapEdges: {
  7308. * targets: [
  7309. * interact.snappers.grid({
  7310. * top: 50,
  7311. * left: 50,
  7312. * bottom: 100,
  7313. * right: 100,
  7314. * }),
  7315. * ],
  7316. * },
  7317. * })
  7318. */
  7319. function __start_35(arg) {
  7320. var edges = arg.interaction.prepared.edges;
  7321. if (!edges) {
  7322. return null;
  7323. }
  7324. arg.state.targetFields = arg.state.targetFields || [[edges.left ? 'left' : 'right', edges.top ? 'top' : 'bottom']];
  7325. return _size["default"].start(arg);
  7326. }
  7327. function __set_35(arg) {
  7328. return _size["default"].set(arg);
  7329. }
  7330. var snapEdges = {
  7331. start: __start_35,
  7332. set: __set_35,
  7333. defaults: (0, ___extend_35["default"])((0, ___clone_35["default"])(_size["default"].defaults), {
  7334. offset: {
  7335. x: 0,
  7336. y: 0
  7337. }
  7338. })
  7339. };
  7340. var ___default_35 = snapEdges;
  7341. _$edges_35["default"] = ___default_35;
  7342. var _$modifiers_31 = {};
  7343. "use strict";
  7344. Object.defineProperty(_$modifiers_31, "__esModule", {
  7345. value: true
  7346. });
  7347. _$modifiers_31.restrictSize = _$modifiers_31.restrictEdges = _$modifiers_31.restrict = _$modifiers_31.snapEdges = _$modifiers_31.snapSize = _$modifiers_31.snap = void 0;
  7348. var ___base_31 = ___interopRequireDefault_31(_$base_30);
  7349. var ___edges_31 = ___interopRequireDefault_31(_$edges_32);
  7350. var ___pointer_31 = ___interopRequireDefault_31(_$pointer_33);
  7351. var ___size_31 = ___interopRequireDefault_31(_$size_34);
  7352. var _edges2 = ___interopRequireDefault_31(_$edges_35);
  7353. var _pointer2 = ___interopRequireDefault_31(_$pointer_36);
  7354. var _size2 = ___interopRequireDefault_31(_$size_37);
  7355. function ___interopRequireDefault_31(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7356. var __makeModifier_31 = ___base_31["default"].makeModifier;
  7357. var __snap_31 = __makeModifier_31(_pointer2["default"], 'snap');
  7358. _$modifiers_31.snap = __snap_31;
  7359. var __snapSize_31 = __makeModifier_31(_size2["default"], 'snapSize');
  7360. _$modifiers_31.snapSize = __snapSize_31;
  7361. var __snapEdges_31 = __makeModifier_31(_edges2["default"], 'snapEdges');
  7362. _$modifiers_31.snapEdges = __snapEdges_31;
  7363. var __restrict_31 = __makeModifier_31(___pointer_31["default"], 'restrict');
  7364. _$modifiers_31.restrict = __restrict_31;
  7365. var __restrictEdges_31 = __makeModifier_31(___edges_31["default"], 'restrictEdges');
  7366. _$modifiers_31.restrictEdges = __restrictEdges_31;
  7367. var __restrictSize_31 = __makeModifier_31(___size_31["default"], 'restrictSize');
  7368. _$modifiers_31.restrictSize = __restrictSize_31;
  7369. var _$PointerEvent_38 = {};
  7370. "use strict";
  7371. Object.defineProperty(_$PointerEvent_38, "__esModule", {
  7372. value: true
  7373. });
  7374. _$PointerEvent_38["default"] = void 0;
  7375. var ___BaseEvent2_38 = ___interopRequireDefault_38(_$BaseEvent_13);
  7376. var ___pointerUtils_38 = ___interopRequireDefault_38(_$pointerUtils_60);
  7377. function ___interopRequireDefault_38(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7378. function ___typeof_38(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_38 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_38 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_38(obj); }
  7379. function ___classCallCheck_38(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7380. function ___defineProperties_38(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
  7381. function ___createClass_38(Constructor, protoProps, staticProps) { if (protoProps) ___defineProperties_38(Constructor.prototype, protoProps); if (staticProps) ___defineProperties_38(Constructor, staticProps); return Constructor; }
  7382. function ___possibleConstructorReturn_38(self, call) { if (call && (___typeof_38(call) === "object" || typeof call === "function")) { return call; } return ___assertThisInitialized_38(self); }
  7383. function ___getPrototypeOf_38(o) { ___getPrototypeOf_38 = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return ___getPrototypeOf_38(o); }
  7384. function ___assertThisInitialized_38(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
  7385. function ___inherits_38(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) ___setPrototypeOf_38(subClass, superClass); }
  7386. function ___setPrototypeOf_38(o, p) { ___setPrototypeOf_38 = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return ___setPrototypeOf_38(o, p); }
  7387. /** */
  7388. var PointerEvent =
  7389. /*#__PURE__*/
  7390. function (_BaseEvent) {
  7391. ___inherits_38(PointerEvent, _BaseEvent);
  7392. /** */
  7393. function PointerEvent(type, pointer, event, eventTarget, interaction, timeStamp) {
  7394. var _this;
  7395. ___classCallCheck_38(this, PointerEvent);
  7396. _this = ___possibleConstructorReturn_38(this, ___getPrototypeOf_38(PointerEvent).call(this, interaction));
  7397. ___pointerUtils_38["default"].pointerExtend(___assertThisInitialized_38(_this), event);
  7398. if (event !== pointer) {
  7399. ___pointerUtils_38["default"].pointerExtend(___assertThisInitialized_38(_this), pointer);
  7400. }
  7401. _this.timeStamp = timeStamp;
  7402. _this.originalEvent = event;
  7403. _this.type = type;
  7404. _this.pointerId = ___pointerUtils_38["default"].getPointerId(pointer);
  7405. _this.pointerType = ___pointerUtils_38["default"].getPointerType(pointer);
  7406. _this.target = eventTarget;
  7407. _this.currentTarget = null;
  7408. if (type === 'tap') {
  7409. var pointerIndex = interaction.getPointerIndex(pointer);
  7410. _this.dt = _this.timeStamp - interaction.pointers[pointerIndex].downTime;
  7411. var interval = _this.timeStamp - interaction.tapTime;
  7412. _this["double"] = !!(interaction.prevTap && interaction.prevTap.type !== 'doubletap' && interaction.prevTap.target === _this.target && interval < 500);
  7413. } else if (type === 'doubletap') {
  7414. _this.dt = pointer.timeStamp - interaction.tapTime;
  7415. }
  7416. return _this;
  7417. }
  7418. ___createClass_38(PointerEvent, [{
  7419. key: "_subtractOrigin",
  7420. value: function _subtractOrigin(_ref) {
  7421. var originX = _ref.x,
  7422. originY = _ref.y;
  7423. this.pageX -= originX;
  7424. this.pageY -= originY;
  7425. this.clientX -= originX;
  7426. this.clientY -= originY;
  7427. return this;
  7428. }
  7429. }, {
  7430. key: "_addOrigin",
  7431. value: function _addOrigin(_ref2) {
  7432. var originX = _ref2.x,
  7433. originY = _ref2.y;
  7434. this.pageX += originX;
  7435. this.pageY += originY;
  7436. this.clientX += originX;
  7437. this.clientY += originY;
  7438. return this;
  7439. }
  7440. /**
  7441. * Prevent the default behaviour of the original Event
  7442. */
  7443. }, {
  7444. key: "preventDefault",
  7445. value: function preventDefault() {
  7446. this.originalEvent.preventDefault();
  7447. }
  7448. }]);
  7449. return PointerEvent;
  7450. }(___BaseEvent2_38["default"]);
  7451. _$PointerEvent_38["default"] = PointerEvent;
  7452. var _$base_39 = {};
  7453. "use strict";
  7454. Object.defineProperty(_$base_39, "__esModule", {
  7455. value: true
  7456. });
  7457. _$base_39["default"] = void 0;
  7458. var __utils_39 = ___interopRequireWildcard_39(_$utils_55);
  7459. var _PointerEvent = ___interopRequireDefault_39(_$PointerEvent_38);
  7460. function ___interopRequireDefault_39(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7461. function ___interopRequireWildcard_39(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  7462. var signals = new __utils_39.Signals();
  7463. var simpleSignals = ['down', 'up', 'cancel'];
  7464. var simpleEvents = ['down', 'up', 'cancel'];
  7465. var __defaults_39 = {
  7466. holdDuration: 600,
  7467. ignoreFrom: null,
  7468. allowFrom: null,
  7469. origin: {
  7470. x: 0,
  7471. y: 0
  7472. }
  7473. };
  7474. var pointerEvents = {
  7475. id: 'pointer-events/base',
  7476. install: __install_39,
  7477. signals: signals,
  7478. PointerEvent: _PointerEvent["default"],
  7479. fire: fire,
  7480. collectEventTargets: collectEventTargets,
  7481. createSignalListener: createSignalListener,
  7482. defaults: __defaults_39,
  7483. types: ['down', 'move', 'up', 'cancel', 'tap', 'doubletap', 'hold']
  7484. };
  7485. function fire(arg, scope) {
  7486. var interaction = arg.interaction,
  7487. pointer = arg.pointer,
  7488. event = arg.event,
  7489. eventTarget = arg.eventTarget,
  7490. _arg$type = arg.type,
  7491. type = _arg$type === void 0 ? arg.pointerEvent.type : _arg$type,
  7492. _arg$targets = arg.targets,
  7493. targets = _arg$targets === void 0 ? collectEventTargets(arg) : _arg$targets;
  7494. var _arg$pointerEvent = arg.pointerEvent,
  7495. pointerEvent = _arg$pointerEvent === void 0 ? new _PointerEvent["default"](type, pointer, event, eventTarget, interaction, scope.now()) : _arg$pointerEvent;
  7496. var signalArg = {
  7497. interaction: interaction,
  7498. pointer: pointer,
  7499. event: event,
  7500. eventTarget: eventTarget,
  7501. targets: targets,
  7502. type: type,
  7503. pointerEvent: pointerEvent
  7504. };
  7505. for (var i = 0; i < targets.length; i++) {
  7506. var target = targets[i];
  7507. for (var prop in target.props || {}) {
  7508. pointerEvent[prop] = target.props[prop];
  7509. }
  7510. var origin = __utils_39.getOriginXY(target.eventable, target.node);
  7511. pointerEvent._subtractOrigin(origin);
  7512. pointerEvent.eventable = target.eventable;
  7513. pointerEvent.currentTarget = target.node;
  7514. target.eventable.fire(pointerEvent);
  7515. pointerEvent._addOrigin(origin);
  7516. if (pointerEvent.immediatePropagationStopped || pointerEvent.propagationStopped && i + 1 < targets.length && targets[i + 1].node !== pointerEvent.currentTarget) {
  7517. break;
  7518. }
  7519. }
  7520. signals.fire('fired', signalArg);
  7521. if (type === 'tap') {
  7522. // if pointerEvent should make a double tap, create and fire a doubletap
  7523. // PointerEvent and use that as the prevTap
  7524. var prevTap = pointerEvent["double"] ? fire({
  7525. interaction: interaction,
  7526. pointer: pointer,
  7527. event: event,
  7528. eventTarget: eventTarget,
  7529. type: 'doubletap'
  7530. }, scope) : pointerEvent;
  7531. interaction.prevTap = prevTap;
  7532. interaction.tapTime = prevTap.timeStamp;
  7533. }
  7534. return pointerEvent;
  7535. }
  7536. function collectEventTargets(_ref) {
  7537. var interaction = _ref.interaction,
  7538. pointer = _ref.pointer,
  7539. event = _ref.event,
  7540. eventTarget = _ref.eventTarget,
  7541. type = _ref.type;
  7542. var pointerIndex = interaction.getPointerIndex(pointer);
  7543. var pointerInfo = interaction.pointers[pointerIndex]; // do not fire a tap event if the pointer was moved before being lifted
  7544. if (type === 'tap' && (interaction.pointerWasMoved || // or if the pointerup target is different to the pointerdown target
  7545. !(pointerInfo && pointerInfo.downTarget === eventTarget))) {
  7546. return [];
  7547. }
  7548. var path = __utils_39.dom.getPath(eventTarget);
  7549. var signalArg = {
  7550. interaction: interaction,
  7551. pointer: pointer,
  7552. event: event,
  7553. eventTarget: eventTarget,
  7554. type: type,
  7555. path: path,
  7556. targets: [],
  7557. node: null
  7558. };
  7559. for (var _i = 0; _i < path.length; _i++) {
  7560. var _ref2;
  7561. _ref2 = path[_i];
  7562. var node = _ref2;
  7563. signalArg.node = node;
  7564. signals.fire('collect-targets', signalArg);
  7565. }
  7566. if (type === 'hold') {
  7567. signalArg.targets = signalArg.targets.filter(function (target) {
  7568. return target.eventable.options.holdDuration === interaction.pointers[pointerIndex].hold.duration;
  7569. });
  7570. }
  7571. return signalArg.targets;
  7572. }
  7573. function __install_39(scope) {
  7574. var interactions = scope.interactions;
  7575. scope.pointerEvents = pointerEvents;
  7576. scope.defaults.actions.pointerEvents = pointerEvents.defaults;
  7577. interactions.signals.on('new', function (_ref3) {
  7578. var interaction = _ref3.interaction;
  7579. interaction.prevTap = null; // the most recent tap event on this interaction
  7580. interaction.tapTime = 0; // time of the most recent tap event
  7581. });
  7582. interactions.signals.on('update-pointer', function (_ref4) {
  7583. var down = _ref4.down,
  7584. pointerInfo = _ref4.pointerInfo;
  7585. if (!down && pointerInfo.hold) {
  7586. return;
  7587. }
  7588. pointerInfo.hold = {
  7589. duration: Infinity,
  7590. timeout: null
  7591. };
  7592. });
  7593. interactions.signals.on('move', function (_ref5) {
  7594. var interaction = _ref5.interaction,
  7595. pointer = _ref5.pointer,
  7596. event = _ref5.event,
  7597. eventTarget = _ref5.eventTarget,
  7598. duplicateMove = _ref5.duplicateMove;
  7599. var pointerIndex = interaction.getPointerIndex(pointer);
  7600. if (!duplicateMove && (!interaction.pointerIsDown || interaction.pointerWasMoved)) {
  7601. if (interaction.pointerIsDown) {
  7602. clearTimeout(interaction.pointers[pointerIndex].hold.timeout);
  7603. }
  7604. fire({
  7605. interaction: interaction,
  7606. pointer: pointer,
  7607. event: event,
  7608. eventTarget: eventTarget,
  7609. type: 'move'
  7610. }, scope);
  7611. }
  7612. });
  7613. interactions.signals.on('down', function (_ref6) {
  7614. var interaction = _ref6.interaction,
  7615. pointer = _ref6.pointer,
  7616. event = _ref6.event,
  7617. eventTarget = _ref6.eventTarget,
  7618. pointerIndex = _ref6.pointerIndex;
  7619. var timer = interaction.pointers[pointerIndex].hold;
  7620. var path = __utils_39.dom.getPath(eventTarget);
  7621. var signalArg = {
  7622. interaction: interaction,
  7623. pointer: pointer,
  7624. event: event,
  7625. eventTarget: eventTarget,
  7626. type: 'hold',
  7627. targets: [],
  7628. path: path,
  7629. element: null
  7630. };
  7631. for (var _i2 = 0; _i2 < path.length; _i2++) {
  7632. var _ref7;
  7633. _ref7 = path[_i2];
  7634. var element = _ref7;
  7635. signalArg.element = element;
  7636. signals.fire('collect-targets', signalArg);
  7637. }
  7638. if (!signalArg.targets.length) {
  7639. return;
  7640. }
  7641. var minDuration = Infinity;
  7642. for (var _i3 = 0; _i3 < signalArg.targets.length; _i3++) {
  7643. var _ref8;
  7644. _ref8 = signalArg.targets[_i3];
  7645. var target = _ref8;
  7646. var holdDuration = target.eventable.options.holdDuration;
  7647. if (holdDuration < minDuration) {
  7648. minDuration = holdDuration;
  7649. }
  7650. }
  7651. timer.duration = minDuration;
  7652. timer.timeout = setTimeout(function () {
  7653. fire({
  7654. interaction: interaction,
  7655. eventTarget: eventTarget,
  7656. pointer: pointer,
  7657. event: event,
  7658. type: 'hold'
  7659. }, scope);
  7660. }, minDuration);
  7661. });
  7662. var _arr = ['up', 'cancel'];
  7663. for (var _i4 = 0; _i4 < _arr.length; _i4++) {
  7664. var signalName = _arr[_i4];
  7665. interactions.signals.on(signalName, function (_ref10) {
  7666. var interaction = _ref10.interaction,
  7667. pointerIndex = _ref10.pointerIndex;
  7668. if (interaction.pointers[pointerIndex].hold) {
  7669. clearTimeout(interaction.pointers[pointerIndex].hold.timeout);
  7670. }
  7671. });
  7672. }
  7673. for (var i = 0; i < simpleSignals.length; i++) {
  7674. interactions.signals.on(simpleSignals[i], createSignalListener(simpleEvents[i], scope));
  7675. }
  7676. interactions.signals.on('up', function (_ref9) {
  7677. var interaction = _ref9.interaction,
  7678. pointer = _ref9.pointer,
  7679. event = _ref9.event,
  7680. eventTarget = _ref9.eventTarget;
  7681. if (!interaction.pointerWasMoved) {
  7682. fire({
  7683. interaction: interaction,
  7684. eventTarget: eventTarget,
  7685. pointer: pointer,
  7686. event: event,
  7687. type: 'tap'
  7688. }, scope);
  7689. }
  7690. });
  7691. }
  7692. function createSignalListener(type, scope) {
  7693. return function (_ref11) {
  7694. var interaction = _ref11.interaction,
  7695. pointer = _ref11.pointer,
  7696. event = _ref11.event,
  7697. eventTarget = _ref11.eventTarget;
  7698. fire({
  7699. interaction: interaction,
  7700. eventTarget: eventTarget,
  7701. pointer: pointer,
  7702. event: event,
  7703. type: type
  7704. }, scope);
  7705. };
  7706. }
  7707. var ___default_39 = pointerEvents;
  7708. _$base_39["default"] = ___default_39;
  7709. var _$holdRepeat_40 = {};
  7710. "use strict";
  7711. Object.defineProperty(_$holdRepeat_40, "__esModule", {
  7712. value: true
  7713. });
  7714. _$holdRepeat_40["default"] = void 0;
  7715. var ___base_40 = ___interopRequireDefault_40(_$base_39);
  7716. function ___interopRequireDefault_40(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7717. function __install_40(scope) {
  7718. var pointerEvents = scope.pointerEvents,
  7719. interactions = scope.interactions;
  7720. scope.usePlugin(___base_40["default"]);
  7721. pointerEvents.signals.on('new', onNew);
  7722. pointerEvents.signals.on('fired', function (arg) {
  7723. return onFired(arg, scope);
  7724. });
  7725. var _arr = ['move', 'up', 'cancel', 'endall'];
  7726. for (var _i = 0; _i < _arr.length; _i++) {
  7727. var signal = _arr[_i];
  7728. interactions.signals.on(signal, endHoldRepeat);
  7729. } // don't repeat by default
  7730. pointerEvents.defaults.holdRepeatInterval = 0;
  7731. pointerEvents.types.push('holdrepeat');
  7732. }
  7733. function onNew(_ref) {
  7734. var pointerEvent = _ref.pointerEvent;
  7735. if (pointerEvent.type !== 'hold') {
  7736. return;
  7737. }
  7738. pointerEvent.count = (pointerEvent.count || 0) + 1;
  7739. }
  7740. function onFired(_ref2, scope) {
  7741. var interaction = _ref2.interaction,
  7742. pointerEvent = _ref2.pointerEvent,
  7743. eventTarget = _ref2.eventTarget,
  7744. targets = _ref2.targets;
  7745. if (pointerEvent.type !== 'hold' || !targets.length) {
  7746. return;
  7747. } // get the repeat interval from the first eventable
  7748. var interval = targets[0].eventable.options.holdRepeatInterval; // don't repeat if the interval is 0 or less
  7749. if (interval <= 0) {
  7750. return;
  7751. } // set a timeout to fire the holdrepeat event
  7752. interaction.holdIntervalHandle = setTimeout(function () {
  7753. scope.pointerEvents.fire({
  7754. interaction: interaction,
  7755. eventTarget: eventTarget,
  7756. type: 'hold',
  7757. pointer: pointerEvent,
  7758. event: pointerEvent
  7759. }, scope);
  7760. }, interval);
  7761. }
  7762. function endHoldRepeat(_ref3) {
  7763. var interaction = _ref3.interaction;
  7764. // set the interaction's holdStopTime property
  7765. // to stop further holdRepeat events
  7766. if (interaction.holdIntervalHandle) {
  7767. clearInterval(interaction.holdIntervalHandle);
  7768. interaction.holdIntervalHandle = null;
  7769. }
  7770. }
  7771. var ___default_40 = {
  7772. id: 'pointer-events/holdRepeat',
  7773. install: __install_40
  7774. };
  7775. _$holdRepeat_40["default"] = ___default_40;
  7776. var _$interactableTargets_42 = {};
  7777. "use strict";
  7778. Object.defineProperty(_$interactableTargets_42, "__esModule", {
  7779. value: true
  7780. });
  7781. _$interactableTargets_42["default"] = void 0;
  7782. /* removed: var _$arr_46 = require("@interactjs/utils/arr"); */;
  7783. var ___extend_42 = ___interopRequireDefault_42(_$extend_52);
  7784. function ___interopRequireDefault_42(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7785. function __install_42(scope) {
  7786. var pointerEvents = scope.pointerEvents,
  7787. actions = scope.actions,
  7788. Interactable = scope.Interactable,
  7789. interactables = scope.interactables;
  7790. pointerEvents.signals.on('collect-targets', function (_ref) {
  7791. var targets = _ref.targets,
  7792. node = _ref.node,
  7793. type = _ref.type,
  7794. eventTarget = _ref.eventTarget;
  7795. scope.interactables.forEachMatch(node, function (interactable) {
  7796. var eventable = interactable.events;
  7797. var options = eventable.options;
  7798. if (eventable.types[type] && eventable.types[type].length && interactable.testIgnoreAllow(options, node, eventTarget)) {
  7799. targets.push({
  7800. node: node,
  7801. eventable: eventable,
  7802. props: {
  7803. interactable: interactable
  7804. }
  7805. });
  7806. }
  7807. });
  7808. });
  7809. interactables.signals.on('new', function (_ref2) {
  7810. var interactable = _ref2.interactable;
  7811. interactable.events.getRect = function (element) {
  7812. return interactable.getRect(element);
  7813. };
  7814. });
  7815. interactables.signals.on('set', function (_ref3) {
  7816. var interactable = _ref3.interactable,
  7817. options = _ref3.options;
  7818. (0, ___extend_42["default"])(interactable.events.options, pointerEvents.defaults);
  7819. (0, ___extend_42["default"])(interactable.events.options, options.pointerEvents || {});
  7820. });
  7821. (0, _$arr_46.merge)(actions.eventTypes, pointerEvents.types);
  7822. Interactable.prototype.pointerEvents = pointerEventsMethod;
  7823. var __backCompatOption = Interactable.prototype._backCompatOption;
  7824. Interactable.prototype._backCompatOption = function (optionName, newValue) {
  7825. var ret = __backCompatOption.call(this, optionName, newValue);
  7826. if (ret === this) {
  7827. this.events.options[optionName] = newValue;
  7828. }
  7829. return ret;
  7830. };
  7831. }
  7832. function pointerEventsMethod(options) {
  7833. (0, ___extend_42["default"])(this.events.options, options);
  7834. return this;
  7835. }
  7836. var ___default_42 = {
  7837. id: 'pointer-events/interactableTargets',
  7838. install: __install_42
  7839. };
  7840. _$interactableTargets_42["default"] = ___default_42;
  7841. var _$pointerEvents_41 = {};
  7842. "use strict";
  7843. Object.defineProperty(_$pointerEvents_41, "__esModule", {
  7844. value: true
  7845. });
  7846. _$pointerEvents_41.install = __install_41;
  7847. Object.defineProperty(_$pointerEvents_41, "pointerEvents", {
  7848. enumerable: true,
  7849. get: function get() {
  7850. return ___base_41["default"];
  7851. }
  7852. });
  7853. Object.defineProperty(_$pointerEvents_41, "holdRepeat", {
  7854. enumerable: true,
  7855. get: function get() {
  7856. return _holdRepeat["default"];
  7857. }
  7858. });
  7859. Object.defineProperty(_$pointerEvents_41, "interactableTargets", {
  7860. enumerable: true,
  7861. get: function get() {
  7862. return _interactableTargets["default"];
  7863. }
  7864. });
  7865. _$pointerEvents_41.id = void 0;
  7866. var ___base_41 = ___interopRequireDefault_41(_$base_39);
  7867. var _holdRepeat = ___interopRequireDefault_41(_$holdRepeat_40);
  7868. var _interactableTargets = ___interopRequireDefault_41(_$interactableTargets_42);
  7869. function ___interopRequireDefault_41(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  7870. function __install_41(scope) {
  7871. scope.usePlugin(___base_41["default"]);
  7872. scope.usePlugin(_holdRepeat["default"]);
  7873. scope.usePlugin(_interactableTargets["default"]);
  7874. }
  7875. var __id_41 = 'pointer-events';
  7876. _$pointerEvents_41.id = __id_41;
  7877. var _$reflow_43 = {};
  7878. "use strict";
  7879. Object.defineProperty(_$reflow_43, "__esModule", {
  7880. value: true
  7881. });
  7882. _$reflow_43.install = __install_43;
  7883. _$reflow_43["default"] = void 0;
  7884. /* removed: var _$InteractEvent_15 = require("@interactjs/core/InteractEvent"); */;
  7885. /* removed: var _$utils_55 = require("@interactjs/utils"); */;
  7886. _$InteractEvent_15.EventPhase.Reflow = 'reflow';
  7887. function __install_43(scope) {
  7888. var actions = scope.actions,
  7889. interactions = scope.interactions,
  7890. Interactable = scope.Interactable; // add action reflow event types
  7891. for (var _i = 0; _i < actions.names.length; _i++) {
  7892. var _ref;
  7893. _ref = actions.names[_i];
  7894. var actionName = _ref;
  7895. actions.eventTypes.push("".concat(actionName, "reflow"));
  7896. } // remove completed reflow interactions
  7897. interactions.signals.on('stop', function (_ref2) {
  7898. var interaction = _ref2.interaction;
  7899. if (interaction.pointerType === _$InteractEvent_15.EventPhase.Reflow) {
  7900. if (interaction._reflowResolve) {
  7901. interaction._reflowResolve();
  7902. }
  7903. _$utils_55.arr.remove(scope.interactions.list, interaction);
  7904. }
  7905. });
  7906. /**
  7907. * ```js
  7908. * const interactable = interact(target)
  7909. * const drag = { name: drag, axis: 'x' }
  7910. * const resize = { name: resize, edges: { left: true, bottom: true }
  7911. *
  7912. * interactable.reflow(drag)
  7913. * interactable.reflow(resize)
  7914. * ```
  7915. *
  7916. * Start an action sequence to re-apply modifiers, check drops, etc.
  7917. *
  7918. * @param { Object } action The action to begin
  7919. * @param { string } action.name The name of the action
  7920. * @returns { Promise<Interactable> }
  7921. */
  7922. Interactable.prototype.reflow = function (action) {
  7923. return reflow(this, action, scope);
  7924. };
  7925. }
  7926. function reflow(interactable, action, scope) {
  7927. var elements = _$utils_55.is.string(interactable.target) ? _$utils_55.arr.from(interactable._context.querySelectorAll(interactable.target)) : [interactable.target]; // tslint:disable-next-line variable-name
  7928. var Promise = _$utils_55.win.window.Promise;
  7929. var promises = Promise ? [] : null;
  7930. var _loop = function _loop() {
  7931. _ref3 = elements[_i2];
  7932. var element = _ref3;
  7933. var rect = interactable.getRect(element);
  7934. if (!rect) {
  7935. return "break";
  7936. }
  7937. var runningInteraction = _$utils_55.arr.find(scope.interactions.list, function (interaction) {
  7938. return interaction.interacting() && interaction.interactable === interactable && interaction.element === element && interaction.prepared.name === action.name;
  7939. });
  7940. var reflowPromise = void 0;
  7941. if (runningInteraction) {
  7942. runningInteraction.move();
  7943. if (promises) {
  7944. reflowPromise = runningInteraction._reflowPromise || new Promise(function (resolve) {
  7945. runningInteraction._reflowResolve = resolve;
  7946. });
  7947. }
  7948. } else {
  7949. var xywh = _$utils_55.rect.tlbrToXywh(rect);
  7950. var coords = {
  7951. page: {
  7952. x: xywh.x,
  7953. y: xywh.y
  7954. },
  7955. client: {
  7956. x: xywh.x,
  7957. y: xywh.y
  7958. },
  7959. timeStamp: scope.now()
  7960. };
  7961. var event = _$utils_55.pointer.coordsToEvent(coords);
  7962. reflowPromise = startReflow(scope, interactable, element, action, event);
  7963. }
  7964. if (promises) {
  7965. promises.push(reflowPromise);
  7966. }
  7967. };
  7968. for (var _i2 = 0; _i2 < elements.length; _i2++) {
  7969. var _ref3;
  7970. var _ret = _loop();
  7971. if (_ret === "break") break;
  7972. }
  7973. return promises && Promise.all(promises).then(function () {
  7974. return interactable;
  7975. });
  7976. }
  7977. function startReflow(scope, interactable, element, action, event) {
  7978. var interaction = scope.interactions["new"]({
  7979. pointerType: 'reflow'
  7980. });
  7981. var signalArg = {
  7982. interaction: interaction,
  7983. event: event,
  7984. pointer: event,
  7985. eventTarget: element,
  7986. phase: _$InteractEvent_15.EventPhase.Reflow
  7987. };
  7988. interaction.interactable = interactable;
  7989. interaction.element = element;
  7990. interaction.prepared = (0, _$utils_55.extend)({}, action);
  7991. interaction.prevEvent = event;
  7992. interaction.updatePointer(event, event, element, true);
  7993. interaction._doPhase(signalArg);
  7994. var reflowPromise = _$utils_55.win.window.Promise ? new _$utils_55.win.window.Promise(function (resolve) {
  7995. interaction._reflowResolve = resolve;
  7996. }) : null;
  7997. interaction._reflowPromise = reflowPromise;
  7998. interaction.start(action, interactable, element);
  7999. if (interaction._interacting) {
  8000. interaction.move(signalArg);
  8001. interaction.end(event);
  8002. } else {
  8003. interaction.stop();
  8004. }
  8005. interaction.removePointer(event, event);
  8006. interaction.pointerIsDown = false;
  8007. return reflowPromise;
  8008. }
  8009. var ___default_43 = {
  8010. id: 'reflow',
  8011. install: __install_43
  8012. };
  8013. _$reflow_43["default"] = ___default_43;
  8014. var _$interact_28 = {};
  8015. "use strict";
  8016. Object.defineProperty(_$interact_28, "__esModule", {
  8017. value: true
  8018. });
  8019. _$interact_28["default"] = _$interact_28.scope = _$interact_28.interact = void 0;
  8020. var ___scope_28 = _$scope_24({});
  8021. var __utils_28 = ___interopRequireWildcard_28(_$utils_55);
  8022. var ___browser_28 = ___interopRequireDefault_28(_$browser_47);
  8023. var ___events_28 = ___interopRequireDefault_28(_$events_51);
  8024. function ___interopRequireDefault_28(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8025. function ___interopRequireWildcard_28(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  8026. /** @module interact */
  8027. var globalEvents = {};
  8028. var scope = new ___scope_28.Scope();
  8029. /**
  8030. * ```js
  8031. * interact('#draggable').draggable(true)
  8032. *
  8033. * var rectables = interact('rect')
  8034. * rectables
  8035. * .gesturable(true)
  8036. * .on('gesturemove', function (event) {
  8037. * // ...
  8038. * })
  8039. * ```
  8040. *
  8041. * The methods of this variable can be used to set elements as interactables
  8042. * and also to change various default settings.
  8043. *
  8044. * Calling it as a function and passing an element or a valid CSS selector
  8045. * string returns an Interactable object which has various methods to configure
  8046. * it.
  8047. *
  8048. * @global
  8049. *
  8050. * @param {Element | string} target The HTML or SVG Element to interact with
  8051. * or CSS selector
  8052. * @return {Interactable}
  8053. */
  8054. _$interact_28.scope = scope;
  8055. var interact = function interact(target, options) {
  8056. var interactable = scope.interactables.get(target, options);
  8057. if (!interactable) {
  8058. interactable = scope.interactables["new"](target, options);
  8059. interactable.events.global = globalEvents;
  8060. }
  8061. return interactable;
  8062. };
  8063. /**
  8064. * Use a plugin
  8065. *
  8066. * @alias module:interact.use
  8067. *
  8068. * @param {Object} plugin
  8069. * @param {function} plugin.install
  8070. * @return {interact}
  8071. */
  8072. _$interact_28.interact = interact;
  8073. interact.use = use;
  8074. function use(plugin, options) {
  8075. scope.usePlugin(plugin, options);
  8076. return interact;
  8077. }
  8078. /**
  8079. * Check if an element or selector has been set with the {@link interact}
  8080. * function
  8081. *
  8082. * @alias module:interact.isSet
  8083. *
  8084. * @param {Element} element The Element being searched for
  8085. * @return {boolean} Indicates if the element or CSS selector was previously
  8086. * passed to interact
  8087. */
  8088. interact.isSet = isSet;
  8089. function isSet(target, options) {
  8090. return !!scope.interactables.get(target, options && options.context);
  8091. }
  8092. /**
  8093. * Add a global listener for an InteractEvent or adds a DOM event to `document`
  8094. *
  8095. * @alias module:interact.on
  8096. *
  8097. * @param {string | array | object} type The types of events to listen for
  8098. * @param {function} listener The function event (s)
  8099. * @param {object | boolean} [options] object or useCapture flag for
  8100. * addEventListener
  8101. * @return {object} interact
  8102. */
  8103. interact.on = on;
  8104. function on(type, listener, options) {
  8105. if (__utils_28.is.string(type) && type.search(' ') !== -1) {
  8106. type = type.trim().split(/ +/);
  8107. }
  8108. if (__utils_28.is.array(type)) {
  8109. for (var _i = 0; _i < type.length; _i++) {
  8110. var _ref;
  8111. _ref = type[_i];
  8112. var eventType = _ref;
  8113. interact.on(eventType, listener, options);
  8114. }
  8115. return interact;
  8116. }
  8117. if (__utils_28.is.object(type)) {
  8118. for (var prop in type) {
  8119. interact.on(prop, type[prop], listener);
  8120. }
  8121. return interact;
  8122. } // if it is an InteractEvent type, add listener to globalEvents
  8123. if (__utils_28.arr.contains(scope.actions.eventTypes, type)) {
  8124. // if this type of event was never bound
  8125. if (!globalEvents[type]) {
  8126. globalEvents[type] = [listener];
  8127. } else {
  8128. globalEvents[type].push(listener);
  8129. }
  8130. } // If non InteractEvent type, addEventListener to document
  8131. else {
  8132. ___events_28["default"].add(scope.document, type, listener, {
  8133. options: options
  8134. });
  8135. }
  8136. return interact;
  8137. }
  8138. /**
  8139. * Removes a global InteractEvent listener or DOM event from `document`
  8140. *
  8141. * @alias module:interact.off
  8142. *
  8143. * @param {string | array | object} type The types of events that were listened
  8144. * for
  8145. * @param {function} listener The listener function to be removed
  8146. * @param {object | boolean} options [options] object or useCapture flag for
  8147. * removeEventListener
  8148. * @return {object} interact
  8149. */
  8150. interact.off = off;
  8151. function off(type, listener, options) {
  8152. if (__utils_28.is.string(type) && type.search(' ') !== -1) {
  8153. type = type.trim().split(/ +/);
  8154. }
  8155. if (__utils_28.is.array(type)) {
  8156. for (var _i2 = 0; _i2 < type.length; _i2++) {
  8157. var _ref2;
  8158. _ref2 = type[_i2];
  8159. var eventType = _ref2;
  8160. interact.off(eventType, listener, options);
  8161. }
  8162. return interact;
  8163. }
  8164. if (__utils_28.is.object(type)) {
  8165. for (var prop in type) {
  8166. interact.off(prop, type[prop], listener);
  8167. }
  8168. return interact;
  8169. }
  8170. if (!__utils_28.arr.contains(scope.actions.eventTypes, type)) {
  8171. ___events_28["default"].remove(scope.document, type, listener, options);
  8172. } else {
  8173. var index;
  8174. if (type in globalEvents && (index = globalEvents[type].indexOf(listener)) !== -1) {
  8175. globalEvents[type].splice(index, 1);
  8176. }
  8177. }
  8178. return interact;
  8179. }
  8180. /**
  8181. * Returns an object which exposes internal data
  8182. * @alias module:interact.debug
  8183. *
  8184. * @return {object} An object with properties that outline the current state
  8185. * and expose internal functions and variables
  8186. */
  8187. interact.debug = debug;
  8188. function debug() {
  8189. return scope;
  8190. } // expose the functions used to calculate multi-touch properties
  8191. interact.getPointerAverage = __utils_28.pointer.pointerAverage;
  8192. interact.getTouchBBox = __utils_28.pointer.touchBBox;
  8193. interact.getTouchDistance = __utils_28.pointer.touchDistance;
  8194. interact.getTouchAngle = __utils_28.pointer.touchAngle;
  8195. interact.getElementRect = __utils_28.dom.getElementRect;
  8196. interact.getElementClientRect = __utils_28.dom.getElementClientRect;
  8197. interact.matchesSelector = __utils_28.dom.matchesSelector;
  8198. interact.closest = __utils_28.dom.closest;
  8199. /**
  8200. * @alias module:interact.supportsTouch
  8201. *
  8202. * @return {boolean} Whether or not the browser supports touch input
  8203. */
  8204. interact.supportsTouch = supportsTouch;
  8205. function supportsTouch() {
  8206. return ___browser_28["default"].supportsTouch;
  8207. }
  8208. /**
  8209. * @alias module:interact.supportsPointerEvent
  8210. *
  8211. * @return {boolean} Whether or not the browser supports PointerEvents
  8212. */
  8213. interact.supportsPointerEvent = supportsPointerEvent;
  8214. function supportsPointerEvent() {
  8215. return ___browser_28["default"].supportsPointerEvent;
  8216. }
  8217. /**
  8218. * Cancels all interactions (end events are not fired)
  8219. *
  8220. * @alias module:interact.stop
  8221. *
  8222. * @return {object} interact
  8223. */
  8224. interact.stop = __stop_28;
  8225. function __stop_28() {
  8226. for (var _i3 = 0; _i3 < scope.interactions.list.length; _i3++) {
  8227. var _ref3;
  8228. _ref3 = scope.interactions.list[_i3];
  8229. var interaction = _ref3;
  8230. interaction.stop();
  8231. }
  8232. return interact;
  8233. }
  8234. /**
  8235. * Returns or sets the distance the pointer must be moved before an action
  8236. * sequence occurs. This also affects tolerance for tap events.
  8237. *
  8238. * @alias module:interact.pointerMoveTolerance
  8239. *
  8240. * @param {number} [newValue] The movement from the start position must be greater than this value
  8241. * @return {interact | number}
  8242. */
  8243. interact.pointerMoveTolerance = pointerMoveTolerance;
  8244. function pointerMoveTolerance(newValue) {
  8245. if (__utils_28.is.number(newValue)) {
  8246. scope.interactions.pointerMoveTolerance = newValue;
  8247. return interact;
  8248. }
  8249. return scope.interactions.pointerMoveTolerance;
  8250. }
  8251. scope.interactables.signals.on('unset', function (_ref4) {
  8252. var interactable = _ref4.interactable;
  8253. scope.interactables.list.splice(scope.interactables.list.indexOf(interactable), 1); // Stop related interactions when an Interactable is unset
  8254. for (var _i4 = 0; _i4 < scope.interactions.list.length; _i4++) {
  8255. var _ref5;
  8256. _ref5 = scope.interactions.list[_i4];
  8257. var interaction = _ref5;
  8258. if (interaction.interactable === interactable && interaction.interacting() && !interaction._ending) {
  8259. interaction.stop();
  8260. }
  8261. }
  8262. });
  8263. interact.addDocument = function (doc, options) {
  8264. return scope.addDocument(doc, options);
  8265. };
  8266. interact.removeDocument = function (doc) {
  8267. return scope.removeDocument(doc);
  8268. };
  8269. scope.interact = interact;
  8270. var ___default_28 = interact;
  8271. _$interact_28["default"] = ___default_28;
  8272. var _$interact_27 = {};
  8273. "use strict";
  8274. Object.defineProperty(_$interact_27, "__esModule", {
  8275. value: true
  8276. });
  8277. _$interact_27.init = __init_27;
  8278. Object.defineProperty(_$interact_27, "autoScroll", {
  8279. enumerable: true,
  8280. get: function get() {
  8281. return _autoScroll["default"];
  8282. }
  8283. });
  8284. Object.defineProperty(_$interact_27, "interactablePreventDefault", {
  8285. enumerable: true,
  8286. get: function get() {
  8287. return _interactablePreventDefault["default"];
  8288. }
  8289. });
  8290. Object.defineProperty(_$interact_27, "inertia", {
  8291. enumerable: true,
  8292. get: function get() {
  8293. return _inertia["default"];
  8294. }
  8295. });
  8296. Object.defineProperty(_$interact_27, "modifiers", {
  8297. enumerable: true,
  8298. get: function get() {
  8299. return ___base_27["default"];
  8300. }
  8301. });
  8302. Object.defineProperty(_$interact_27, "reflow", {
  8303. enumerable: true,
  8304. get: function get() {
  8305. return _reflow["default"];
  8306. }
  8307. });
  8308. Object.defineProperty(_$interact_27, "interact", {
  8309. enumerable: true,
  8310. get: function get() {
  8311. return _interact["default"];
  8312. }
  8313. });
  8314. _$interact_27.pointerEvents = _$interact_27.actions = _$interact_27["default"] = void 0;
  8315. var actions = ___interopRequireWildcard_27(_$actions_5);
  8316. _$interact_27.actions = actions;
  8317. var _autoScroll = ___interopRequireDefault_27(_$autoScroll_7);
  8318. var autoStart = ___interopRequireWildcard_27(_$autoStart_12);
  8319. var _interactablePreventDefault = ___interopRequireDefault_27(_$interactablePreventDefault_21);
  8320. var _devTools = ___interopRequireDefault_27(_$devTools_25);
  8321. var _inertia = ___interopRequireDefault_27(_$inertia_26);
  8322. var modifiers = ___interopRequireWildcard_27(_$modifiers_31);
  8323. var ___base_27 = ___interopRequireDefault_27(_$base_30);
  8324. var __pointerEvents_27 = ___interopRequireWildcard_27(_$pointerEvents_41);
  8325. _$interact_27.pointerEvents = __pointerEvents_27;
  8326. var _reflow = ___interopRequireDefault_27(_$reflow_43);
  8327. var _interact = ___interopRequireWildcard_27(_$interact_28);
  8328. function ___interopRequireDefault_27(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8329. function ___interopRequireWildcard_27(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  8330. function __init_27(window) {
  8331. _interact.scope.init(window);
  8332. _interact["default"].use(_interactablePreventDefault["default"]); // inertia
  8333. _interact["default"].use(_inertia["default"]); // pointerEvents
  8334. _interact["default"].use(__pointerEvents_27); // autoStart, hold
  8335. _interact["default"].use(autoStart); // drag and drop, resize, gesture
  8336. _interact["default"].use(actions); // snap, resize, etc.
  8337. _interact["default"].use(___base_27["default"]); // for backwrads compatibility
  8338. for (var type in modifiers) {
  8339. var _modifiers$type = modifiers[type],
  8340. _defaults = _modifiers$type._defaults,
  8341. _methods = _modifiers$type._methods;
  8342. _defaults._methods = _methods;
  8343. _interact.scope.defaults.perAction[type] = _defaults;
  8344. } // autoScroll
  8345. _interact["default"].use(_autoScroll["default"]); // reflow
  8346. _interact["default"].use(_reflow["default"]); // eslint-disable-next-line no-undef
  8347. if (false) {}
  8348. return _interact["default"];
  8349. } // eslint-disable-next-line no-undef
  8350. _interact["default"].version = "1.4.9";
  8351. var ___default_27 = _interact["default"];
  8352. _$interact_27["default"] = ___default_27;
  8353. var _$types_44 = {};
  8354. /// <reference path="./types.d.ts" />
  8355. "use strict";
  8356. var _$grid_63 = {};
  8357. "use strict";
  8358. Object.defineProperty(_$grid_63, "__esModule", {
  8359. value: true
  8360. });
  8361. _$grid_63["default"] = void 0;
  8362. function ___slicedToArray_63(arr, i) { return ___arrayWithHoles_63(arr) || ___iterableToArrayLimit_63(arr, i) || ___nonIterableRest_63(); }
  8363. function ___nonIterableRest_63() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  8364. function ___iterableToArrayLimit_63(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  8365. function ___arrayWithHoles_63(arr) { if (Array.isArray(arr)) return arr; }
  8366. function createGrid(grid) {
  8367. var coordFields = [['x', 'y'], ['left', 'top'], ['right', 'bottom'], ['width', 'height']].filter(function (_ref) {
  8368. var _ref2 = ___slicedToArray_63(_ref, 2),
  8369. xField = _ref2[0],
  8370. yField = _ref2[1];
  8371. return xField in grid || yField in grid;
  8372. });
  8373. return function (x, y) {
  8374. var range = grid.range,
  8375. _grid$limits = grid.limits,
  8376. limits = _grid$limits === void 0 ? {
  8377. left: -Infinity,
  8378. right: Infinity,
  8379. top: -Infinity,
  8380. bottom: Infinity
  8381. } : _grid$limits,
  8382. _grid$offset = grid.offset,
  8383. offset = _grid$offset === void 0 ? {
  8384. x: 0,
  8385. y: 0
  8386. } : _grid$offset;
  8387. var result = {
  8388. range: range
  8389. };
  8390. for (var _i2 = 0; _i2 < coordFields.length; _i2++) {
  8391. var _ref3;
  8392. _ref3 = coordFields[_i2];
  8393. var _ref4 = _ref3,
  8394. _ref5 = ___slicedToArray_63(_ref4, 2),
  8395. xField = _ref5[0],
  8396. yField = _ref5[1];
  8397. var gridx = Math.round((x - offset.x) / grid[xField]);
  8398. var gridy = Math.round((y - offset.y) / grid[yField]);
  8399. result[xField] = Math.max(limits.left, Math.min(limits.right, gridx * grid[xField] + offset.x));
  8400. result[yField] = Math.max(limits.top, Math.min(limits.bottom, gridy * grid[yField] + offset.y));
  8401. }
  8402. return result;
  8403. };
  8404. }
  8405. var ___default_63 = createGrid;
  8406. _$grid_63["default"] = ___default_63;
  8407. var _$snappers_64 = {};
  8408. "use strict";
  8409. Object.defineProperty(_$snappers_64, "__esModule", {
  8410. value: true
  8411. });
  8412. Object.defineProperty(_$snappers_64, "grid", {
  8413. enumerable: true,
  8414. get: function get() {
  8415. return _grid["default"];
  8416. }
  8417. });
  8418. var _grid = ___interopRequireDefault_64(_$grid_63);
  8419. function ___interopRequireDefault_64(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8420. var _$index_29 = { exports: {} };
  8421. "use strict";
  8422. Object.defineProperty(_$index_29.exports, "__esModule", {
  8423. value: true
  8424. });
  8425. _$index_29.exports.init = __init_29;
  8426. _$index_29.exports["default"] = void 0;
  8427. var ___interact_29 = ___interopRequireWildcard_29(_$interact_27);
  8428. var __modifiers_29 = ___interopRequireWildcard_29(_$modifiers_31);
  8429. _$types_44;
  8430. var ___extend_29 = ___interopRequireDefault_29(_$extend_52);
  8431. var snappers = ___interopRequireWildcard_29(_$snappers_64);
  8432. function ___interopRequireDefault_29(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
  8433. function ___interopRequireWildcard_29(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj["default"] = obj; return newObj; } }
  8434. function ___typeof_29(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { ___typeof_29 = function _typeof(obj) { return typeof obj; }; } else { ___typeof_29 = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return ___typeof_29(obj); }
  8435. if ((typeof window === "undefined" ? "undefined" : ___typeof_29(window)) === 'object' && !!window) {
  8436. __init_29(window);
  8437. }
  8438. function __init_29(win) {
  8439. (0, ___interact_29.init)(win);
  8440. return ___interact_29["default"].use({
  8441. id: 'interactjs',
  8442. install: function install(scope) {
  8443. ___interact_29["default"].modifiers = (0, ___extend_29["default"])(scope.modifiers, __modifiers_29);
  8444. ___interact_29["default"].snappers = snappers;
  8445. ___interact_29["default"].createSnapGrid = ___interact_29["default"].snappers.grid;
  8446. }
  8447. });
  8448. }
  8449. var ___default_29 = ___interact_29["default"];
  8450. _$index_29.exports["default"] = ___default_29;
  8451. ___interact_29["default"]['default'] = ___interact_29["default"]; // tslint:disable-line no-string-literal
  8452. ___interact_29["default"]['init'] = __init_29; // tslint:disable-line no-string-literal
  8453. if (( false ? undefined : ___typeof_29(_$index_29)) === 'object' && !!_$index_29) {
  8454. _$index_29.exports = ___interact_29["default"];
  8455. }
  8456. _$index_29 = _$index_29.exports
  8457. return _$index_29;
  8458. });
  8459. //# sourceMappingURL=interact.js.map
  8460. /***/ }),
  8461. /***/ "./node_modules/lodash.debounce/index.js":
  8462. /*!***********************************************!*\
  8463. !*** ./node_modules/lodash.debounce/index.js ***!
  8464. \***********************************************/
  8465. /*! no static exports found */
  8466. /***/ (function(module, exports, __webpack_require__) {
  8467. /* WEBPACK VAR INJECTION */(function(global) {/**
  8468. * lodash (Custom Build) <https://lodash.com/>
  8469. * Build: `lodash modularize exports="npm" -o ./`
  8470. * Copyright jQuery Foundation and other contributors <https://jquery.org/>
  8471. * Released under MIT license <https://lodash.com/license>
  8472. * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
  8473. * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
  8474. */
  8475. /** Used as the `TypeError` message for "Functions" methods. */
  8476. var FUNC_ERROR_TEXT = 'Expected a function';
  8477. /** Used as references for various `Number` constants. */
  8478. var NAN = 0 / 0;
  8479. /** `Object#toString` result references. */
  8480. var symbolTag = '[object Symbol]';
  8481. /** Used to match leading and trailing whitespace. */
  8482. var reTrim = /^\s+|\s+$/g;
  8483. /** Used to detect bad signed hexadecimal string values. */
  8484. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  8485. /** Used to detect binary string values. */
  8486. var reIsBinary = /^0b[01]+$/i;
  8487. /** Used to detect octal string values. */
  8488. var reIsOctal = /^0o[0-7]+$/i;
  8489. /** Built-in method references without a dependency on `root`. */
  8490. var freeParseInt = parseInt;
  8491. /** Detect free variable `global` from Node.js. */
  8492. var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
  8493. /** Detect free variable `self`. */
  8494. var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
  8495. /** Used as a reference to the global object. */
  8496. var root = freeGlobal || freeSelf || Function('return this')();
  8497. /** Used for built-in method references. */
  8498. var objectProto = Object.prototype;
  8499. /**
  8500. * Used to resolve the
  8501. * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
  8502. * of values.
  8503. */
  8504. var objectToString = objectProto.toString;
  8505. /* Built-in method references for those with the same name as other `lodash` methods. */
  8506. var nativeMax = Math.max,
  8507. nativeMin = Math.min;
  8508. /**
  8509. * Gets the timestamp of the number of milliseconds that have elapsed since
  8510. * the Unix epoch (1 January 1970 00:00:00 UTC).
  8511. *
  8512. * @static
  8513. * @memberOf _
  8514. * @since 2.4.0
  8515. * @category Date
  8516. * @returns {number} Returns the timestamp.
  8517. * @example
  8518. *
  8519. * _.defer(function(stamp) {
  8520. * console.log(_.now() - stamp);
  8521. * }, _.now());
  8522. * // => Logs the number of milliseconds it took for the deferred invocation.
  8523. */
  8524. var now = function() {
  8525. return root.Date.now();
  8526. };
  8527. /**
  8528. * Creates a debounced function that delays invoking `func` until after `wait`
  8529. * milliseconds have elapsed since the last time the debounced function was
  8530. * invoked. The debounced function comes with a `cancel` method to cancel
  8531. * delayed `func` invocations and a `flush` method to immediately invoke them.
  8532. * Provide `options` to indicate whether `func` should be invoked on the
  8533. * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
  8534. * with the last arguments provided to the debounced function. Subsequent
  8535. * calls to the debounced function return the result of the last `func`
  8536. * invocation.
  8537. *
  8538. * **Note:** If `leading` and `trailing` options are `true`, `func` is
  8539. * invoked on the trailing edge of the timeout only if the debounced function
  8540. * is invoked more than once during the `wait` timeout.
  8541. *
  8542. * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
  8543. * until to the next tick, similar to `setTimeout` with a timeout of `0`.
  8544. *
  8545. * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
  8546. * for details over the differences between `_.debounce` and `_.throttle`.
  8547. *
  8548. * @static
  8549. * @memberOf _
  8550. * @since 0.1.0
  8551. * @category Function
  8552. * @param {Function} func The function to debounce.
  8553. * @param {number} [wait=0] The number of milliseconds to delay.
  8554. * @param {Object} [options={}] The options object.
  8555. * @param {boolean} [options.leading=false]
  8556. * Specify invoking on the leading edge of the timeout.
  8557. * @param {number} [options.maxWait]
  8558. * The maximum time `func` is allowed to be delayed before it's invoked.
  8559. * @param {boolean} [options.trailing=true]
  8560. * Specify invoking on the trailing edge of the timeout.
  8561. * @returns {Function} Returns the new debounced function.
  8562. * @example
  8563. *
  8564. * // Avoid costly calculations while the window size is in flux.
  8565. * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
  8566. *
  8567. * // Invoke `sendMail` when clicked, debouncing subsequent calls.
  8568. * jQuery(element).on('click', _.debounce(sendMail, 300, {
  8569. * 'leading': true,
  8570. * 'trailing': false
  8571. * }));
  8572. *
  8573. * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
  8574. * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
  8575. * var source = new EventSource('/stream');
  8576. * jQuery(source).on('message', debounced);
  8577. *
  8578. * // Cancel the trailing debounced invocation.
  8579. * jQuery(window).on('popstate', debounced.cancel);
  8580. */
  8581. function debounce(func, wait, options) {
  8582. var lastArgs,
  8583. lastThis,
  8584. maxWait,
  8585. result,
  8586. timerId,
  8587. lastCallTime,
  8588. lastInvokeTime = 0,
  8589. leading = false,
  8590. maxing = false,
  8591. trailing = true;
  8592. if (typeof func != 'function') {
  8593. throw new TypeError(FUNC_ERROR_TEXT);
  8594. }
  8595. wait = toNumber(wait) || 0;
  8596. if (isObject(options)) {
  8597. leading = !!options.leading;
  8598. maxing = 'maxWait' in options;
  8599. maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
  8600. trailing = 'trailing' in options ? !!options.trailing : trailing;
  8601. }
  8602. function invokeFunc(time) {
  8603. var args = lastArgs,
  8604. thisArg = lastThis;
  8605. lastArgs = lastThis = undefined;
  8606. lastInvokeTime = time;
  8607. result = func.apply(thisArg, args);
  8608. return result;
  8609. }
  8610. function leadingEdge(time) {
  8611. // Reset any `maxWait` timer.
  8612. lastInvokeTime = time;
  8613. // Start the timer for the trailing edge.
  8614. timerId = setTimeout(timerExpired, wait);
  8615. // Invoke the leading edge.
  8616. return leading ? invokeFunc(time) : result;
  8617. }
  8618. function remainingWait(time) {
  8619. var timeSinceLastCall = time - lastCallTime,
  8620. timeSinceLastInvoke = time - lastInvokeTime,
  8621. result = wait - timeSinceLastCall;
  8622. return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;
  8623. }
  8624. function shouldInvoke(time) {
  8625. var timeSinceLastCall = time - lastCallTime,
  8626. timeSinceLastInvoke = time - lastInvokeTime;
  8627. // Either this is the first call, activity has stopped and we're at the
  8628. // trailing edge, the system time has gone backwards and we're treating
  8629. // it as the trailing edge, or we've hit the `maxWait` limit.
  8630. return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
  8631. (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
  8632. }
  8633. function timerExpired() {
  8634. var time = now();
  8635. if (shouldInvoke(time)) {
  8636. return trailingEdge(time);
  8637. }
  8638. // Restart the timer.
  8639. timerId = setTimeout(timerExpired, remainingWait(time));
  8640. }
  8641. function trailingEdge(time) {
  8642. timerId = undefined;
  8643. // Only invoke if we have `lastArgs` which means `func` has been
  8644. // debounced at least once.
  8645. if (trailing && lastArgs) {
  8646. return invokeFunc(time);
  8647. }
  8648. lastArgs = lastThis = undefined;
  8649. return result;
  8650. }
  8651. function cancel() {
  8652. if (timerId !== undefined) {
  8653. clearTimeout(timerId);
  8654. }
  8655. lastInvokeTime = 0;
  8656. lastArgs = lastCallTime = lastThis = timerId = undefined;
  8657. }
  8658. function flush() {
  8659. return timerId === undefined ? result : trailingEdge(now());
  8660. }
  8661. function debounced() {
  8662. var time = now(),
  8663. isInvoking = shouldInvoke(time);
  8664. lastArgs = arguments;
  8665. lastThis = this;
  8666. lastCallTime = time;
  8667. if (isInvoking) {
  8668. if (timerId === undefined) {
  8669. return leadingEdge(lastCallTime);
  8670. }
  8671. if (maxing) {
  8672. // Handle invocations in a tight loop.
  8673. timerId = setTimeout(timerExpired, wait);
  8674. return invokeFunc(lastCallTime);
  8675. }
  8676. }
  8677. if (timerId === undefined) {
  8678. timerId = setTimeout(timerExpired, wait);
  8679. }
  8680. return result;
  8681. }
  8682. debounced.cancel = cancel;
  8683. debounced.flush = flush;
  8684. return debounced;
  8685. }
  8686. /**
  8687. * Checks if `value` is the
  8688. * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
  8689. * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
  8690. *
  8691. * @static
  8692. * @memberOf _
  8693. * @since 0.1.0
  8694. * @category Lang
  8695. * @param {*} value The value to check.
  8696. * @returns {boolean} Returns `true` if `value` is an object, else `false`.
  8697. * @example
  8698. *
  8699. * _.isObject({});
  8700. * // => true
  8701. *
  8702. * _.isObject([1, 2, 3]);
  8703. * // => true
  8704. *
  8705. * _.isObject(_.noop);
  8706. * // => true
  8707. *
  8708. * _.isObject(null);
  8709. * // => false
  8710. */
  8711. function isObject(value) {
  8712. var type = typeof value;
  8713. return !!value && (type == 'object' || type == 'function');
  8714. }
  8715. /**
  8716. * Checks if `value` is object-like. A value is object-like if it's not `null`
  8717. * and has a `typeof` result of "object".
  8718. *
  8719. * @static
  8720. * @memberOf _
  8721. * @since 4.0.0
  8722. * @category Lang
  8723. * @param {*} value The value to check.
  8724. * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
  8725. * @example
  8726. *
  8727. * _.isObjectLike({});
  8728. * // => true
  8729. *
  8730. * _.isObjectLike([1, 2, 3]);
  8731. * // => true
  8732. *
  8733. * _.isObjectLike(_.noop);
  8734. * // => false
  8735. *
  8736. * _.isObjectLike(null);
  8737. * // => false
  8738. */
  8739. function isObjectLike(value) {
  8740. return !!value && typeof value == 'object';
  8741. }
  8742. /**
  8743. * Checks if `value` is classified as a `Symbol` primitive or object.
  8744. *
  8745. * @static
  8746. * @memberOf _
  8747. * @since 4.0.0
  8748. * @category Lang
  8749. * @param {*} value The value to check.
  8750. * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
  8751. * @example
  8752. *
  8753. * _.isSymbol(Symbol.iterator);
  8754. * // => true
  8755. *
  8756. * _.isSymbol('abc');
  8757. * // => false
  8758. */
  8759. function isSymbol(value) {
  8760. return typeof value == 'symbol' ||
  8761. (isObjectLike(value) && objectToString.call(value) == symbolTag);
  8762. }
  8763. /**
  8764. * Converts `value` to a number.
  8765. *
  8766. * @static
  8767. * @memberOf _
  8768. * @since 4.0.0
  8769. * @category Lang
  8770. * @param {*} value The value to process.
  8771. * @returns {number} Returns the number.
  8772. * @example
  8773. *
  8774. * _.toNumber(3.2);
  8775. * // => 3.2
  8776. *
  8777. * _.toNumber(Number.MIN_VALUE);
  8778. * // => 5e-324
  8779. *
  8780. * _.toNumber(Infinity);
  8781. * // => Infinity
  8782. *
  8783. * _.toNumber('3.2');
  8784. * // => 3.2
  8785. */
  8786. function toNumber(value) {
  8787. if (typeof value == 'number') {
  8788. return value;
  8789. }
  8790. if (isSymbol(value)) {
  8791. return NAN;
  8792. }
  8793. if (isObject(value)) {
  8794. var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
  8795. value = isObject(other) ? (other + '') : other;
  8796. }
  8797. if (typeof value != 'string') {
  8798. return value === 0 ? value : +value;
  8799. }
  8800. value = value.replace(reTrim, '');
  8801. var isBinary = reIsBinary.test(value);
  8802. return (isBinary || reIsOctal.test(value))
  8803. ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
  8804. : (reIsBadHex.test(value) ? NAN : +value);
  8805. }
  8806. module.exports = debounce;
  8807. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  8808. /***/ }),
  8809. /***/ "./node_modules/popper.js/dist/esm/popper.js":
  8810. /*!***************************************************!*\
  8811. !*** ./node_modules/popper.js/dist/esm/popper.js ***!
  8812. \***************************************************/
  8813. /*! exports provided: default */
  8814. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8815. "use strict";
  8816. __webpack_require__.r(__webpack_exports__);
  8817. /* WEBPACK VAR INJECTION */(function(global) {/**!
  8818. * @fileOverview Kickass library to create and place poppers near their reference elements.
  8819. * @version 1.15.0
  8820. * @license
  8821. * Copyright (c) 2016 Federico Zivolo and contributors
  8822. *
  8823. * Permission is hereby granted, free of charge, to any person obtaining a copy
  8824. * of this software and associated documentation files (the "Software"), to deal
  8825. * in the Software without restriction, including without limitation the rights
  8826. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8827. * copies of the Software, and to permit persons to whom the Software is
  8828. * furnished to do so, subject to the following conditions:
  8829. *
  8830. * The above copyright notice and this permission notice shall be included in all
  8831. * copies or substantial portions of the Software.
  8832. *
  8833. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  8834. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  8835. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  8836. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  8837. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  8838. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  8839. * SOFTWARE.
  8840. */
  8841. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  8842. var longerTimeoutBrowsers = ['Edge', 'Trident', 'Firefox'];
  8843. var timeoutDuration = 0;
  8844. for (var i = 0; i < longerTimeoutBrowsers.length; i += 1) {
  8845. if (isBrowser && navigator.userAgent.indexOf(longerTimeoutBrowsers[i]) >= 0) {
  8846. timeoutDuration = 1;
  8847. break;
  8848. }
  8849. }
  8850. function microtaskDebounce(fn) {
  8851. var called = false;
  8852. return function () {
  8853. if (called) {
  8854. return;
  8855. }
  8856. called = true;
  8857. window.Promise.resolve().then(function () {
  8858. called = false;
  8859. fn();
  8860. });
  8861. };
  8862. }
  8863. function taskDebounce(fn) {
  8864. var scheduled = false;
  8865. return function () {
  8866. if (!scheduled) {
  8867. scheduled = true;
  8868. setTimeout(function () {
  8869. scheduled = false;
  8870. fn();
  8871. }, timeoutDuration);
  8872. }
  8873. };
  8874. }
  8875. var supportsMicroTasks = isBrowser && window.Promise;
  8876. /**
  8877. * Create a debounced version of a method, that's asynchronously deferred
  8878. * but called in the minimum time possible.
  8879. *
  8880. * @method
  8881. * @memberof Popper.Utils
  8882. * @argument {Function} fn
  8883. * @returns {Function}
  8884. */
  8885. var debounce = supportsMicroTasks ? microtaskDebounce : taskDebounce;
  8886. /**
  8887. * Check if the given variable is a function
  8888. * @method
  8889. * @memberof Popper.Utils
  8890. * @argument {Any} functionToCheck - variable to check
  8891. * @returns {Boolean} answer to: is a function?
  8892. */
  8893. function isFunction(functionToCheck) {
  8894. var getType = {};
  8895. return functionToCheck && getType.toString.call(functionToCheck) === '[object Function]';
  8896. }
  8897. /**
  8898. * Get CSS computed property of the given element
  8899. * @method
  8900. * @memberof Popper.Utils
  8901. * @argument {Eement} element
  8902. * @argument {String} property
  8903. */
  8904. function getStyleComputedProperty(element, property) {
  8905. if (element.nodeType !== 1) {
  8906. return [];
  8907. }
  8908. // NOTE: 1 DOM access here
  8909. var window = element.ownerDocument.defaultView;
  8910. var css = window.getComputedStyle(element, null);
  8911. return property ? css[property] : css;
  8912. }
  8913. /**
  8914. * Returns the parentNode or the host of the element
  8915. * @method
  8916. * @memberof Popper.Utils
  8917. * @argument {Element} element
  8918. * @returns {Element} parent
  8919. */
  8920. function getParentNode(element) {
  8921. if (element.nodeName === 'HTML') {
  8922. return element;
  8923. }
  8924. return element.parentNode || element.host;
  8925. }
  8926. /**
  8927. * Returns the scrolling parent of the given element
  8928. * @method
  8929. * @memberof Popper.Utils
  8930. * @argument {Element} element
  8931. * @returns {Element} scroll parent
  8932. */
  8933. function getScrollParent(element) {
  8934. // Return body, `getScroll` will take care to get the correct `scrollTop` from it
  8935. if (!element) {
  8936. return document.body;
  8937. }
  8938. switch (element.nodeName) {
  8939. case 'HTML':
  8940. case 'BODY':
  8941. return element.ownerDocument.body;
  8942. case '#document':
  8943. return element.body;
  8944. }
  8945. // Firefox want us to check `-x` and `-y` variations as well
  8946. var _getStyleComputedProp = getStyleComputedProperty(element),
  8947. overflow = _getStyleComputedProp.overflow,
  8948. overflowX = _getStyleComputedProp.overflowX,
  8949. overflowY = _getStyleComputedProp.overflowY;
  8950. if (/(auto|scroll|overlay)/.test(overflow + overflowY + overflowX)) {
  8951. return element;
  8952. }
  8953. return getScrollParent(getParentNode(element));
  8954. }
  8955. var isIE11 = isBrowser && !!(window.MSInputMethodContext && document.documentMode);
  8956. var isIE10 = isBrowser && /MSIE 10/.test(navigator.userAgent);
  8957. /**
  8958. * Determines if the browser is Internet Explorer
  8959. * @method
  8960. * @memberof Popper.Utils
  8961. * @param {Number} version to check
  8962. * @returns {Boolean} isIE
  8963. */
  8964. function isIE(version) {
  8965. if (version === 11) {
  8966. return isIE11;
  8967. }
  8968. if (version === 10) {
  8969. return isIE10;
  8970. }
  8971. return isIE11 || isIE10;
  8972. }
  8973. /**
  8974. * Returns the offset parent of the given element
  8975. * @method
  8976. * @memberof Popper.Utils
  8977. * @argument {Element} element
  8978. * @returns {Element} offset parent
  8979. */
  8980. function getOffsetParent(element) {
  8981. if (!element) {
  8982. return document.documentElement;
  8983. }
  8984. var noOffsetParent = isIE(10) ? document.body : null;
  8985. // NOTE: 1 DOM access here
  8986. var offsetParent = element.offsetParent || null;
  8987. // Skip hidden elements which don't have an offsetParent
  8988. while (offsetParent === noOffsetParent && element.nextElementSibling) {
  8989. offsetParent = (element = element.nextElementSibling).offsetParent;
  8990. }
  8991. var nodeName = offsetParent && offsetParent.nodeName;
  8992. if (!nodeName || nodeName === 'BODY' || nodeName === 'HTML') {
  8993. return element ? element.ownerDocument.documentElement : document.documentElement;
  8994. }
  8995. // .offsetParent will return the closest TH, TD or TABLE in case
  8996. // no offsetParent is present, I hate this job...
  8997. if (['TH', 'TD', 'TABLE'].indexOf(offsetParent.nodeName) !== -1 && getStyleComputedProperty(offsetParent, 'position') === 'static') {
  8998. return getOffsetParent(offsetParent);
  8999. }
  9000. return offsetParent;
  9001. }
  9002. function isOffsetContainer(element) {
  9003. var nodeName = element.nodeName;
  9004. if (nodeName === 'BODY') {
  9005. return false;
  9006. }
  9007. return nodeName === 'HTML' || getOffsetParent(element.firstElementChild) === element;
  9008. }
  9009. /**
  9010. * Finds the root node (document, shadowDOM root) of the given element
  9011. * @method
  9012. * @memberof Popper.Utils
  9013. * @argument {Element} node
  9014. * @returns {Element} root node
  9015. */
  9016. function getRoot(node) {
  9017. if (node.parentNode !== null) {
  9018. return getRoot(node.parentNode);
  9019. }
  9020. return node;
  9021. }
  9022. /**
  9023. * Finds the offset parent common to the two provided nodes
  9024. * @method
  9025. * @memberof Popper.Utils
  9026. * @argument {Element} element1
  9027. * @argument {Element} element2
  9028. * @returns {Element} common offset parent
  9029. */
  9030. function findCommonOffsetParent(element1, element2) {
  9031. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  9032. if (!element1 || !element1.nodeType || !element2 || !element2.nodeType) {
  9033. return document.documentElement;
  9034. }
  9035. // Here we make sure to give as "start" the element that comes first in the DOM
  9036. var order = element1.compareDocumentPosition(element2) & Node.DOCUMENT_POSITION_FOLLOWING;
  9037. var start = order ? element1 : element2;
  9038. var end = order ? element2 : element1;
  9039. // Get common ancestor container
  9040. var range = document.createRange();
  9041. range.setStart(start, 0);
  9042. range.setEnd(end, 0);
  9043. var commonAncestorContainer = range.commonAncestorContainer;
  9044. // Both nodes are inside #document
  9045. if (element1 !== commonAncestorContainer && element2 !== commonAncestorContainer || start.contains(end)) {
  9046. if (isOffsetContainer(commonAncestorContainer)) {
  9047. return commonAncestorContainer;
  9048. }
  9049. return getOffsetParent(commonAncestorContainer);
  9050. }
  9051. // one of the nodes is inside shadowDOM, find which one
  9052. var element1root = getRoot(element1);
  9053. if (element1root.host) {
  9054. return findCommonOffsetParent(element1root.host, element2);
  9055. } else {
  9056. return findCommonOffsetParent(element1, getRoot(element2).host);
  9057. }
  9058. }
  9059. /**
  9060. * Gets the scroll value of the given element in the given side (top and left)
  9061. * @method
  9062. * @memberof Popper.Utils
  9063. * @argument {Element} element
  9064. * @argument {String} side `top` or `left`
  9065. * @returns {number} amount of scrolled pixels
  9066. */
  9067. function getScroll(element) {
  9068. var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'top';
  9069. var upperSide = side === 'top' ? 'scrollTop' : 'scrollLeft';
  9070. var nodeName = element.nodeName;
  9071. if (nodeName === 'BODY' || nodeName === 'HTML') {
  9072. var html = element.ownerDocument.documentElement;
  9073. var scrollingElement = element.ownerDocument.scrollingElement || html;
  9074. return scrollingElement[upperSide];
  9075. }
  9076. return element[upperSide];
  9077. }
  9078. /*
  9079. * Sum or subtract the element scroll values (left and top) from a given rect object
  9080. * @method
  9081. * @memberof Popper.Utils
  9082. * @param {Object} rect - Rect object you want to change
  9083. * @param {HTMLElement} element - The element from the function reads the scroll values
  9084. * @param {Boolean} subtract - set to true if you want to subtract the scroll values
  9085. * @return {Object} rect - The modifier rect object
  9086. */
  9087. function includeScroll(rect, element) {
  9088. var subtract = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9089. var scrollTop = getScroll(element, 'top');
  9090. var scrollLeft = getScroll(element, 'left');
  9091. var modifier = subtract ? -1 : 1;
  9092. rect.top += scrollTop * modifier;
  9093. rect.bottom += scrollTop * modifier;
  9094. rect.left += scrollLeft * modifier;
  9095. rect.right += scrollLeft * modifier;
  9096. return rect;
  9097. }
  9098. /*
  9099. * Helper to detect borders of a given element
  9100. * @method
  9101. * @memberof Popper.Utils
  9102. * @param {CSSStyleDeclaration} styles
  9103. * Result of `getStyleComputedProperty` on the given element
  9104. * @param {String} axis - `x` or `y`
  9105. * @return {number} borders - The borders size of the given axis
  9106. */
  9107. function getBordersSize(styles, axis) {
  9108. var sideA = axis === 'x' ? 'Left' : 'Top';
  9109. var sideB = sideA === 'Left' ? 'Right' : 'Bottom';
  9110. return parseFloat(styles['border' + sideA + 'Width'], 10) + parseFloat(styles['border' + sideB + 'Width'], 10);
  9111. }
  9112. function getSize(axis, body, html, computedStyle) {
  9113. return Math.max(body['offset' + axis], body['scroll' + axis], html['client' + axis], html['offset' + axis], html['scroll' + axis], isIE(10) ? parseInt(html['offset' + axis]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Top' : 'Left')]) + parseInt(computedStyle['margin' + (axis === 'Height' ? 'Bottom' : 'Right')]) : 0);
  9114. }
  9115. function getWindowSizes(document) {
  9116. var body = document.body;
  9117. var html = document.documentElement;
  9118. var computedStyle = isIE(10) && getComputedStyle(html);
  9119. return {
  9120. height: getSize('Height', body, html, computedStyle),
  9121. width: getSize('Width', body, html, computedStyle)
  9122. };
  9123. }
  9124. var classCallCheck = function (instance, Constructor) {
  9125. if (!(instance instanceof Constructor)) {
  9126. throw new TypeError("Cannot call a class as a function");
  9127. }
  9128. };
  9129. var createClass = function () {
  9130. function defineProperties(target, props) {
  9131. for (var i = 0; i < props.length; i++) {
  9132. var descriptor = props[i];
  9133. descriptor.enumerable = descriptor.enumerable || false;
  9134. descriptor.configurable = true;
  9135. if ("value" in descriptor) descriptor.writable = true;
  9136. Object.defineProperty(target, descriptor.key, descriptor);
  9137. }
  9138. }
  9139. return function (Constructor, protoProps, staticProps) {
  9140. if (protoProps) defineProperties(Constructor.prototype, protoProps);
  9141. if (staticProps) defineProperties(Constructor, staticProps);
  9142. return Constructor;
  9143. };
  9144. }();
  9145. var defineProperty = function (obj, key, value) {
  9146. if (key in obj) {
  9147. Object.defineProperty(obj, key, {
  9148. value: value,
  9149. enumerable: true,
  9150. configurable: true,
  9151. writable: true
  9152. });
  9153. } else {
  9154. obj[key] = value;
  9155. }
  9156. return obj;
  9157. };
  9158. var _extends = Object.assign || function (target) {
  9159. for (var i = 1; i < arguments.length; i++) {
  9160. var source = arguments[i];
  9161. for (var key in source) {
  9162. if (Object.prototype.hasOwnProperty.call(source, key)) {
  9163. target[key] = source[key];
  9164. }
  9165. }
  9166. }
  9167. return target;
  9168. };
  9169. /**
  9170. * Given element offsets, generate an output similar to getBoundingClientRect
  9171. * @method
  9172. * @memberof Popper.Utils
  9173. * @argument {Object} offsets
  9174. * @returns {Object} ClientRect like output
  9175. */
  9176. function getClientRect(offsets) {
  9177. return _extends({}, offsets, {
  9178. right: offsets.left + offsets.width,
  9179. bottom: offsets.top + offsets.height
  9180. });
  9181. }
  9182. /**
  9183. * Get bounding client rect of given element
  9184. * @method
  9185. * @memberof Popper.Utils
  9186. * @param {HTMLElement} element
  9187. * @return {Object} client rect
  9188. */
  9189. function getBoundingClientRect(element) {
  9190. var rect = {};
  9191. // IE10 10 FIX: Please, don't ask, the element isn't
  9192. // considered in DOM in some circumstances...
  9193. // This isn't reproducible in IE10 compatibility mode of IE11
  9194. try {
  9195. if (isIE(10)) {
  9196. rect = element.getBoundingClientRect();
  9197. var scrollTop = getScroll(element, 'top');
  9198. var scrollLeft = getScroll(element, 'left');
  9199. rect.top += scrollTop;
  9200. rect.left += scrollLeft;
  9201. rect.bottom += scrollTop;
  9202. rect.right += scrollLeft;
  9203. } else {
  9204. rect = element.getBoundingClientRect();
  9205. }
  9206. } catch (e) {}
  9207. var result = {
  9208. left: rect.left,
  9209. top: rect.top,
  9210. width: rect.right - rect.left,
  9211. height: rect.bottom - rect.top
  9212. };
  9213. // subtract scrollbar size from sizes
  9214. var sizes = element.nodeName === 'HTML' ? getWindowSizes(element.ownerDocument) : {};
  9215. var width = sizes.width || element.clientWidth || result.right - result.left;
  9216. var height = sizes.height || element.clientHeight || result.bottom - result.top;
  9217. var horizScrollbar = element.offsetWidth - width;
  9218. var vertScrollbar = element.offsetHeight - height;
  9219. // if an hypothetical scrollbar is detected, we must be sure it's not a `border`
  9220. // we make this check conditional for performance reasons
  9221. if (horizScrollbar || vertScrollbar) {
  9222. var styles = getStyleComputedProperty(element);
  9223. horizScrollbar -= getBordersSize(styles, 'x');
  9224. vertScrollbar -= getBordersSize(styles, 'y');
  9225. result.width -= horizScrollbar;
  9226. result.height -= vertScrollbar;
  9227. }
  9228. return getClientRect(result);
  9229. }
  9230. function getOffsetRectRelativeToArbitraryNode(children, parent) {
  9231. var fixedPosition = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  9232. var isIE10 = isIE(10);
  9233. var isHTML = parent.nodeName === 'HTML';
  9234. var childrenRect = getBoundingClientRect(children);
  9235. var parentRect = getBoundingClientRect(parent);
  9236. var scrollParent = getScrollParent(children);
  9237. var styles = getStyleComputedProperty(parent);
  9238. var borderTopWidth = parseFloat(styles.borderTopWidth, 10);
  9239. var borderLeftWidth = parseFloat(styles.borderLeftWidth, 10);
  9240. // In cases where the parent is fixed, we must ignore negative scroll in offset calc
  9241. if (fixedPosition && isHTML) {
  9242. parentRect.top = Math.max(parentRect.top, 0);
  9243. parentRect.left = Math.max(parentRect.left, 0);
  9244. }
  9245. var offsets = getClientRect({
  9246. top: childrenRect.top - parentRect.top - borderTopWidth,
  9247. left: childrenRect.left - parentRect.left - borderLeftWidth,
  9248. width: childrenRect.width,
  9249. height: childrenRect.height
  9250. });
  9251. offsets.marginTop = 0;
  9252. offsets.marginLeft = 0;
  9253. // Subtract margins of documentElement in case it's being used as parent
  9254. // we do this only on HTML because it's the only element that behaves
  9255. // differently when margins are applied to it. The margins are included in
  9256. // the box of the documentElement, in the other cases not.
  9257. if (!isIE10 && isHTML) {
  9258. var marginTop = parseFloat(styles.marginTop, 10);
  9259. var marginLeft = parseFloat(styles.marginLeft, 10);
  9260. offsets.top -= borderTopWidth - marginTop;
  9261. offsets.bottom -= borderTopWidth - marginTop;
  9262. offsets.left -= borderLeftWidth - marginLeft;
  9263. offsets.right -= borderLeftWidth - marginLeft;
  9264. // Attach marginTop and marginLeft because in some circumstances we may need them
  9265. offsets.marginTop = marginTop;
  9266. offsets.marginLeft = marginLeft;
  9267. }
  9268. if (isIE10 && !fixedPosition ? parent.contains(scrollParent) : parent === scrollParent && scrollParent.nodeName !== 'BODY') {
  9269. offsets = includeScroll(offsets, parent);
  9270. }
  9271. return offsets;
  9272. }
  9273. function getViewportOffsetRectRelativeToArtbitraryNode(element) {
  9274. var excludeScroll = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  9275. var html = element.ownerDocument.documentElement;
  9276. var relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
  9277. var width = Math.max(html.clientWidth, window.innerWidth || 0);
  9278. var height = Math.max(html.clientHeight, window.innerHeight || 0);
  9279. var scrollTop = !excludeScroll ? getScroll(html) : 0;
  9280. var scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
  9281. var offset = {
  9282. top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
  9283. left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
  9284. width: width,
  9285. height: height
  9286. };
  9287. return getClientRect(offset);
  9288. }
  9289. /**
  9290. * Check if the given element is fixed or is inside a fixed parent
  9291. * @method
  9292. * @memberof Popper.Utils
  9293. * @argument {Element} element
  9294. * @argument {Element} customContainer
  9295. * @returns {Boolean} answer to "isFixed?"
  9296. */
  9297. function isFixed(element) {
  9298. var nodeName = element.nodeName;
  9299. if (nodeName === 'BODY' || nodeName === 'HTML') {
  9300. return false;
  9301. }
  9302. if (getStyleComputedProperty(element, 'position') === 'fixed') {
  9303. return true;
  9304. }
  9305. var parentNode = getParentNode(element);
  9306. if (!parentNode) {
  9307. return false;
  9308. }
  9309. return isFixed(parentNode);
  9310. }
  9311. /**
  9312. * Finds the first parent of an element that has a transformed property defined
  9313. * @method
  9314. * @memberof Popper.Utils
  9315. * @argument {Element} element
  9316. * @returns {Element} first transformed parent or documentElement
  9317. */
  9318. function getFixedPositionOffsetParent(element) {
  9319. // This check is needed to avoid errors in case one of the elements isn't defined for any reason
  9320. if (!element || !element.parentElement || isIE()) {
  9321. return document.documentElement;
  9322. }
  9323. var el = element.parentElement;
  9324. while (el && getStyleComputedProperty(el, 'transform') === 'none') {
  9325. el = el.parentElement;
  9326. }
  9327. return el || document.documentElement;
  9328. }
  9329. /**
  9330. * Computed the boundaries limits and return them
  9331. * @method
  9332. * @memberof Popper.Utils
  9333. * @param {HTMLElement} popper
  9334. * @param {HTMLElement} reference
  9335. * @param {number} padding
  9336. * @param {HTMLElement} boundariesElement - Element used to define the boundaries
  9337. * @param {Boolean} fixedPosition - Is in fixed position mode
  9338. * @returns {Object} Coordinates of the boundaries
  9339. */
  9340. function getBoundaries(popper, reference, padding, boundariesElement) {
  9341. var fixedPosition = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  9342. // NOTE: 1 DOM access here
  9343. var boundaries = { top: 0, left: 0 };
  9344. var offsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  9345. // Handle viewport case
  9346. if (boundariesElement === 'viewport') {
  9347. boundaries = getViewportOffsetRectRelativeToArtbitraryNode(offsetParent, fixedPosition);
  9348. } else {
  9349. // Handle other cases based on DOM element used as boundaries
  9350. var boundariesNode = void 0;
  9351. if (boundariesElement === 'scrollParent') {
  9352. boundariesNode = getScrollParent(getParentNode(reference));
  9353. if (boundariesNode.nodeName === 'BODY') {
  9354. boundariesNode = popper.ownerDocument.documentElement;
  9355. }
  9356. } else if (boundariesElement === 'window') {
  9357. boundariesNode = popper.ownerDocument.documentElement;
  9358. } else {
  9359. boundariesNode = boundariesElement;
  9360. }
  9361. var offsets = getOffsetRectRelativeToArbitraryNode(boundariesNode, offsetParent, fixedPosition);
  9362. // In case of HTML, we need a different computation
  9363. if (boundariesNode.nodeName === 'HTML' && !isFixed(offsetParent)) {
  9364. var _getWindowSizes = getWindowSizes(popper.ownerDocument),
  9365. height = _getWindowSizes.height,
  9366. width = _getWindowSizes.width;
  9367. boundaries.top += offsets.top - offsets.marginTop;
  9368. boundaries.bottom = height + offsets.top;
  9369. boundaries.left += offsets.left - offsets.marginLeft;
  9370. boundaries.right = width + offsets.left;
  9371. } else {
  9372. // for all the other DOM elements, this one is good
  9373. boundaries = offsets;
  9374. }
  9375. }
  9376. // Add paddings
  9377. padding = padding || 0;
  9378. var isPaddingNumber = typeof padding === 'number';
  9379. boundaries.left += isPaddingNumber ? padding : padding.left || 0;
  9380. boundaries.top += isPaddingNumber ? padding : padding.top || 0;
  9381. boundaries.right -= isPaddingNumber ? padding : padding.right || 0;
  9382. boundaries.bottom -= isPaddingNumber ? padding : padding.bottom || 0;
  9383. return boundaries;
  9384. }
  9385. function getArea(_ref) {
  9386. var width = _ref.width,
  9387. height = _ref.height;
  9388. return width * height;
  9389. }
  9390. /**
  9391. * Utility used to transform the `auto` placement to the placement with more
  9392. * available space.
  9393. * @method
  9394. * @memberof Popper.Utils
  9395. * @argument {Object} data - The data object generated by update method
  9396. * @argument {Object} options - Modifiers configuration and options
  9397. * @returns {Object} The data object, properly modified
  9398. */
  9399. function computeAutoPlacement(placement, refRect, popper, reference, boundariesElement) {
  9400. var padding = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 0;
  9401. if (placement.indexOf('auto') === -1) {
  9402. return placement;
  9403. }
  9404. var boundaries = getBoundaries(popper, reference, padding, boundariesElement);
  9405. var rects = {
  9406. top: {
  9407. width: boundaries.width,
  9408. height: refRect.top - boundaries.top
  9409. },
  9410. right: {
  9411. width: boundaries.right - refRect.right,
  9412. height: boundaries.height
  9413. },
  9414. bottom: {
  9415. width: boundaries.width,
  9416. height: boundaries.bottom - refRect.bottom
  9417. },
  9418. left: {
  9419. width: refRect.left - boundaries.left,
  9420. height: boundaries.height
  9421. }
  9422. };
  9423. var sortedAreas = Object.keys(rects).map(function (key) {
  9424. return _extends({
  9425. key: key
  9426. }, rects[key], {
  9427. area: getArea(rects[key])
  9428. });
  9429. }).sort(function (a, b) {
  9430. return b.area - a.area;
  9431. });
  9432. var filteredAreas = sortedAreas.filter(function (_ref2) {
  9433. var width = _ref2.width,
  9434. height = _ref2.height;
  9435. return width >= popper.clientWidth && height >= popper.clientHeight;
  9436. });
  9437. var computedPlacement = filteredAreas.length > 0 ? filteredAreas[0].key : sortedAreas[0].key;
  9438. var variation = placement.split('-')[1];
  9439. return computedPlacement + (variation ? '-' + variation : '');
  9440. }
  9441. /**
  9442. * Get offsets to the reference element
  9443. * @method
  9444. * @memberof Popper.Utils
  9445. * @param {Object} state
  9446. * @param {Element} popper - the popper element
  9447. * @param {Element} reference - the reference element (the popper will be relative to this)
  9448. * @param {Element} fixedPosition - is in fixed position mode
  9449. * @returns {Object} An object containing the offsets which will be applied to the popper
  9450. */
  9451. function getReferenceOffsets(state, popper, reference) {
  9452. var fixedPosition = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
  9453. var commonOffsetParent = fixedPosition ? getFixedPositionOffsetParent(popper) : findCommonOffsetParent(popper, reference);
  9454. return getOffsetRectRelativeToArbitraryNode(reference, commonOffsetParent, fixedPosition);
  9455. }
  9456. /**
  9457. * Get the outer sizes of the given element (offset size + margins)
  9458. * @method
  9459. * @memberof Popper.Utils
  9460. * @argument {Element} element
  9461. * @returns {Object} object containing width and height properties
  9462. */
  9463. function getOuterSizes(element) {
  9464. var window = element.ownerDocument.defaultView;
  9465. var styles = window.getComputedStyle(element);
  9466. var x = parseFloat(styles.marginTop || 0) + parseFloat(styles.marginBottom || 0);
  9467. var y = parseFloat(styles.marginLeft || 0) + parseFloat(styles.marginRight || 0);
  9468. var result = {
  9469. width: element.offsetWidth + y,
  9470. height: element.offsetHeight + x
  9471. };
  9472. return result;
  9473. }
  9474. /**
  9475. * Get the opposite placement of the given one
  9476. * @method
  9477. * @memberof Popper.Utils
  9478. * @argument {String} placement
  9479. * @returns {String} flipped placement
  9480. */
  9481. function getOppositePlacement(placement) {
  9482. var hash = { left: 'right', right: 'left', bottom: 'top', top: 'bottom' };
  9483. return placement.replace(/left|right|bottom|top/g, function (matched) {
  9484. return hash[matched];
  9485. });
  9486. }
  9487. /**
  9488. * Get offsets to the popper
  9489. * @method
  9490. * @memberof Popper.Utils
  9491. * @param {Object} position - CSS position the Popper will get applied
  9492. * @param {HTMLElement} popper - the popper element
  9493. * @param {Object} referenceOffsets - the reference offsets (the popper will be relative to this)
  9494. * @param {String} placement - one of the valid placement options
  9495. * @returns {Object} popperOffsets - An object containing the offsets which will be applied to the popper
  9496. */
  9497. function getPopperOffsets(popper, referenceOffsets, placement) {
  9498. placement = placement.split('-')[0];
  9499. // Get popper node sizes
  9500. var popperRect = getOuterSizes(popper);
  9501. // Add position, width and height to our offsets object
  9502. var popperOffsets = {
  9503. width: popperRect.width,
  9504. height: popperRect.height
  9505. };
  9506. // depending by the popper placement we have to compute its offsets slightly differently
  9507. var isHoriz = ['right', 'left'].indexOf(placement) !== -1;
  9508. var mainSide = isHoriz ? 'top' : 'left';
  9509. var secondarySide = isHoriz ? 'left' : 'top';
  9510. var measurement = isHoriz ? 'height' : 'width';
  9511. var secondaryMeasurement = !isHoriz ? 'height' : 'width';
  9512. popperOffsets[mainSide] = referenceOffsets[mainSide] + referenceOffsets[measurement] / 2 - popperRect[measurement] / 2;
  9513. if (placement === secondarySide) {
  9514. popperOffsets[secondarySide] = referenceOffsets[secondarySide] - popperRect[secondaryMeasurement];
  9515. } else {
  9516. popperOffsets[secondarySide] = referenceOffsets[getOppositePlacement(secondarySide)];
  9517. }
  9518. return popperOffsets;
  9519. }
  9520. /**
  9521. * Mimics the `find` method of Array
  9522. * @method
  9523. * @memberof Popper.Utils
  9524. * @argument {Array} arr
  9525. * @argument prop
  9526. * @argument value
  9527. * @returns index or -1
  9528. */
  9529. function find(arr, check) {
  9530. // use native find if supported
  9531. if (Array.prototype.find) {
  9532. return arr.find(check);
  9533. }
  9534. // use `filter` to obtain the same behavior of `find`
  9535. return arr.filter(check)[0];
  9536. }
  9537. /**
  9538. * Return the index of the matching object
  9539. * @method
  9540. * @memberof Popper.Utils
  9541. * @argument {Array} arr
  9542. * @argument prop
  9543. * @argument value
  9544. * @returns index or -1
  9545. */
  9546. function findIndex(arr, prop, value) {
  9547. // use native findIndex if supported
  9548. if (Array.prototype.findIndex) {
  9549. return arr.findIndex(function (cur) {
  9550. return cur[prop] === value;
  9551. });
  9552. }
  9553. // use `find` + `indexOf` if `findIndex` isn't supported
  9554. var match = find(arr, function (obj) {
  9555. return obj[prop] === value;
  9556. });
  9557. return arr.indexOf(match);
  9558. }
  9559. /**
  9560. * Loop trough the list of modifiers and run them in order,
  9561. * each of them will then edit the data object.
  9562. * @method
  9563. * @memberof Popper.Utils
  9564. * @param {dataObject} data
  9565. * @param {Array} modifiers
  9566. * @param {String} ends - Optional modifier name used as stopper
  9567. * @returns {dataObject}
  9568. */
  9569. function runModifiers(modifiers, data, ends) {
  9570. var modifiersToRun = ends === undefined ? modifiers : modifiers.slice(0, findIndex(modifiers, 'name', ends));
  9571. modifiersToRun.forEach(function (modifier) {
  9572. if (modifier['function']) {
  9573. // eslint-disable-line dot-notation
  9574. console.warn('`modifier.function` is deprecated, use `modifier.fn`!');
  9575. }
  9576. var fn = modifier['function'] || modifier.fn; // eslint-disable-line dot-notation
  9577. if (modifier.enabled && isFunction(fn)) {
  9578. // Add properties to offsets to make them a complete clientRect object
  9579. // we do this before each modifier to make sure the previous one doesn't
  9580. // mess with these values
  9581. data.offsets.popper = getClientRect(data.offsets.popper);
  9582. data.offsets.reference = getClientRect(data.offsets.reference);
  9583. data = fn(data, modifier);
  9584. }
  9585. });
  9586. return data;
  9587. }
  9588. /**
  9589. * Updates the position of the popper, computing the new offsets and applying
  9590. * the new style.<br />
  9591. * Prefer `scheduleUpdate` over `update` because of performance reasons.
  9592. * @method
  9593. * @memberof Popper
  9594. */
  9595. function update() {
  9596. // if popper is destroyed, don't perform any further update
  9597. if (this.state.isDestroyed) {
  9598. return;
  9599. }
  9600. var data = {
  9601. instance: this,
  9602. styles: {},
  9603. arrowStyles: {},
  9604. attributes: {},
  9605. flipped: false,
  9606. offsets: {}
  9607. };
  9608. // compute reference element offsets
  9609. data.offsets.reference = getReferenceOffsets(this.state, this.popper, this.reference, this.options.positionFixed);
  9610. // compute auto placement, store placement inside the data object,
  9611. // modifiers will be able to edit `placement` if needed
  9612. // and refer to originalPlacement to know the original value
  9613. data.placement = computeAutoPlacement(this.options.placement, data.offsets.reference, this.popper, this.reference, this.options.modifiers.flip.boundariesElement, this.options.modifiers.flip.padding);
  9614. // store the computed placement inside `originalPlacement`
  9615. data.originalPlacement = data.placement;
  9616. data.positionFixed = this.options.positionFixed;
  9617. // compute the popper offsets
  9618. data.offsets.popper = getPopperOffsets(this.popper, data.offsets.reference, data.placement);
  9619. data.offsets.popper.position = this.options.positionFixed ? 'fixed' : 'absolute';
  9620. // run the modifiers
  9621. data = runModifiers(this.modifiers, data);
  9622. // the first `update` will call `onCreate` callback
  9623. // the other ones will call `onUpdate` callback
  9624. if (!this.state.isCreated) {
  9625. this.state.isCreated = true;
  9626. this.options.onCreate(data);
  9627. } else {
  9628. this.options.onUpdate(data);
  9629. }
  9630. }
  9631. /**
  9632. * Helper used to know if the given modifier is enabled.
  9633. * @method
  9634. * @memberof Popper.Utils
  9635. * @returns {Boolean}
  9636. */
  9637. function isModifierEnabled(modifiers, modifierName) {
  9638. return modifiers.some(function (_ref) {
  9639. var name = _ref.name,
  9640. enabled = _ref.enabled;
  9641. return enabled && name === modifierName;
  9642. });
  9643. }
  9644. /**
  9645. * Get the prefixed supported property name
  9646. * @method
  9647. * @memberof Popper.Utils
  9648. * @argument {String} property (camelCase)
  9649. * @returns {String} prefixed property (camelCase or PascalCase, depending on the vendor prefix)
  9650. */
  9651. function getSupportedPropertyName(property) {
  9652. var prefixes = [false, 'ms', 'Webkit', 'Moz', 'O'];
  9653. var upperProp = property.charAt(0).toUpperCase() + property.slice(1);
  9654. for (var i = 0; i < prefixes.length; i++) {
  9655. var prefix = prefixes[i];
  9656. var toCheck = prefix ? '' + prefix + upperProp : property;
  9657. if (typeof document.body.style[toCheck] !== 'undefined') {
  9658. return toCheck;
  9659. }
  9660. }
  9661. return null;
  9662. }
  9663. /**
  9664. * Destroys the popper.
  9665. * @method
  9666. * @memberof Popper
  9667. */
  9668. function destroy() {
  9669. this.state.isDestroyed = true;
  9670. // touch DOM only if `applyStyle` modifier is enabled
  9671. if (isModifierEnabled(this.modifiers, 'applyStyle')) {
  9672. this.popper.removeAttribute('x-placement');
  9673. this.popper.style.position = '';
  9674. this.popper.style.top = '';
  9675. this.popper.style.left = '';
  9676. this.popper.style.right = '';
  9677. this.popper.style.bottom = '';
  9678. this.popper.style.willChange = '';
  9679. this.popper.style[getSupportedPropertyName('transform')] = '';
  9680. }
  9681. this.disableEventListeners();
  9682. // remove the popper if user explicity asked for the deletion on destroy
  9683. // do not use `remove` because IE11 doesn't support it
  9684. if (this.options.removeOnDestroy) {
  9685. this.popper.parentNode.removeChild(this.popper);
  9686. }
  9687. return this;
  9688. }
  9689. /**
  9690. * Get the window associated with the element
  9691. * @argument {Element} element
  9692. * @returns {Window}
  9693. */
  9694. function getWindow(element) {
  9695. var ownerDocument = element.ownerDocument;
  9696. return ownerDocument ? ownerDocument.defaultView : window;
  9697. }
  9698. function attachToScrollParents(scrollParent, event, callback, scrollParents) {
  9699. var isBody = scrollParent.nodeName === 'BODY';
  9700. var target = isBody ? scrollParent.ownerDocument.defaultView : scrollParent;
  9701. target.addEventListener(event, callback, { passive: true });
  9702. if (!isBody) {
  9703. attachToScrollParents(getScrollParent(target.parentNode), event, callback, scrollParents);
  9704. }
  9705. scrollParents.push(target);
  9706. }
  9707. /**
  9708. * Setup needed event listeners used to update the popper position
  9709. * @method
  9710. * @memberof Popper.Utils
  9711. * @private
  9712. */
  9713. function setupEventListeners(reference, options, state, updateBound) {
  9714. // Resize event listener on window
  9715. state.updateBound = updateBound;
  9716. getWindow(reference).addEventListener('resize', state.updateBound, { passive: true });
  9717. // Scroll event listener on scroll parents
  9718. var scrollElement = getScrollParent(reference);
  9719. attachToScrollParents(scrollElement, 'scroll', state.updateBound, state.scrollParents);
  9720. state.scrollElement = scrollElement;
  9721. state.eventsEnabled = true;
  9722. return state;
  9723. }
  9724. /**
  9725. * It will add resize/scroll events and start recalculating
  9726. * position of the popper element when they are triggered.
  9727. * @method
  9728. * @memberof Popper
  9729. */
  9730. function enableEventListeners() {
  9731. if (!this.state.eventsEnabled) {
  9732. this.state = setupEventListeners(this.reference, this.options, this.state, this.scheduleUpdate);
  9733. }
  9734. }
  9735. /**
  9736. * Remove event listeners used to update the popper position
  9737. * @method
  9738. * @memberof Popper.Utils
  9739. * @private
  9740. */
  9741. function removeEventListeners(reference, state) {
  9742. // Remove resize event listener on window
  9743. getWindow(reference).removeEventListener('resize', state.updateBound);
  9744. // Remove scroll event listener on scroll parents
  9745. state.scrollParents.forEach(function (target) {
  9746. target.removeEventListener('scroll', state.updateBound);
  9747. });
  9748. // Reset state
  9749. state.updateBound = null;
  9750. state.scrollParents = [];
  9751. state.scrollElement = null;
  9752. state.eventsEnabled = false;
  9753. return state;
  9754. }
  9755. /**
  9756. * It will remove resize/scroll events and won't recalculate popper position
  9757. * when they are triggered. It also won't trigger `onUpdate` callback anymore,
  9758. * unless you call `update` method manually.
  9759. * @method
  9760. * @memberof Popper
  9761. */
  9762. function disableEventListeners() {
  9763. if (this.state.eventsEnabled) {
  9764. cancelAnimationFrame(this.scheduleUpdate);
  9765. this.state = removeEventListeners(this.reference, this.state);
  9766. }
  9767. }
  9768. /**
  9769. * Tells if a given input is a number
  9770. * @method
  9771. * @memberof Popper.Utils
  9772. * @param {*} input to check
  9773. * @return {Boolean}
  9774. */
  9775. function isNumeric(n) {
  9776. return n !== '' && !isNaN(parseFloat(n)) && isFinite(n);
  9777. }
  9778. /**
  9779. * Set the style to the given popper
  9780. * @method
  9781. * @memberof Popper.Utils
  9782. * @argument {Element} element - Element to apply the style to
  9783. * @argument {Object} styles
  9784. * Object with a list of properties and values which will be applied to the element
  9785. */
  9786. function setStyles(element, styles) {
  9787. Object.keys(styles).forEach(function (prop) {
  9788. var unit = '';
  9789. // add unit if the value is numeric and is one of the following
  9790. if (['width', 'height', 'top', 'right', 'bottom', 'left'].indexOf(prop) !== -1 && isNumeric(styles[prop])) {
  9791. unit = 'px';
  9792. }
  9793. element.style[prop] = styles[prop] + unit;
  9794. });
  9795. }
  9796. /**
  9797. * Set the attributes to the given popper
  9798. * @method
  9799. * @memberof Popper.Utils
  9800. * @argument {Element} element - Element to apply the attributes to
  9801. * @argument {Object} styles
  9802. * Object with a list of properties and values which will be applied to the element
  9803. */
  9804. function setAttributes(element, attributes) {
  9805. Object.keys(attributes).forEach(function (prop) {
  9806. var value = attributes[prop];
  9807. if (value !== false) {
  9808. element.setAttribute(prop, attributes[prop]);
  9809. } else {
  9810. element.removeAttribute(prop);
  9811. }
  9812. });
  9813. }
  9814. /**
  9815. * @function
  9816. * @memberof Modifiers
  9817. * @argument {Object} data - The data object generated by `update` method
  9818. * @argument {Object} data.styles - List of style properties - values to apply to popper element
  9819. * @argument {Object} data.attributes - List of attribute properties - values to apply to popper element
  9820. * @argument {Object} options - Modifiers configuration and options
  9821. * @returns {Object} The same data object
  9822. */
  9823. function applyStyle(data) {
  9824. // any property present in `data.styles` will be applied to the popper,
  9825. // in this way we can make the 3rd party modifiers add custom styles to it
  9826. // Be aware, modifiers could override the properties defined in the previous
  9827. // lines of this modifier!
  9828. setStyles(data.instance.popper, data.styles);
  9829. // any property present in `data.attributes` will be applied to the popper,
  9830. // they will be set as HTML attributes of the element
  9831. setAttributes(data.instance.popper, data.attributes);
  9832. // if arrowElement is defined and arrowStyles has some properties
  9833. if (data.arrowElement && Object.keys(data.arrowStyles).length) {
  9834. setStyles(data.arrowElement, data.arrowStyles);
  9835. }
  9836. return data;
  9837. }
  9838. /**
  9839. * Set the x-placement attribute before everything else because it could be used
  9840. * to add margins to the popper margins needs to be calculated to get the
  9841. * correct popper offsets.
  9842. * @method
  9843. * @memberof Popper.modifiers
  9844. * @param {HTMLElement} reference - The reference element used to position the popper
  9845. * @param {HTMLElement} popper - The HTML element used as popper
  9846. * @param {Object} options - Popper.js options
  9847. */
  9848. function applyStyleOnLoad(reference, popper, options, modifierOptions, state) {
  9849. // compute reference element offsets
  9850. var referenceOffsets = getReferenceOffsets(state, popper, reference, options.positionFixed);
  9851. // compute auto placement, store placement inside the data object,
  9852. // modifiers will be able to edit `placement` if needed
  9853. // and refer to originalPlacement to know the original value
  9854. var placement = computeAutoPlacement(options.placement, referenceOffsets, popper, reference, options.modifiers.flip.boundariesElement, options.modifiers.flip.padding);
  9855. popper.setAttribute('x-placement', placement);
  9856. // Apply `position` to popper before anything else because
  9857. // without the position applied we can't guarantee correct computations
  9858. setStyles(popper, { position: options.positionFixed ? 'fixed' : 'absolute' });
  9859. return options;
  9860. }
  9861. /**
  9862. * @function
  9863. * @memberof Popper.Utils
  9864. * @argument {Object} data - The data object generated by `update` method
  9865. * @argument {Boolean} shouldRound - If the offsets should be rounded at all
  9866. * @returns {Object} The popper's position offsets rounded
  9867. *
  9868. * The tale of pixel-perfect positioning. It's still not 100% perfect, but as
  9869. * good as it can be within reason.
  9870. * Discussion here: https://github.com/FezVrasta/popper.js/pull/715
  9871. *
  9872. * Low DPI screens cause a popper to be blurry if not using full pixels (Safari
  9873. * as well on High DPI screens).
  9874. *
  9875. * Firefox prefers no rounding for positioning and does not have blurriness on
  9876. * high DPI screens.
  9877. *
  9878. * Only horizontal placement and left/right values need to be considered.
  9879. */
  9880. function getRoundedOffsets(data, shouldRound) {
  9881. var _data$offsets = data.offsets,
  9882. popper = _data$offsets.popper,
  9883. reference = _data$offsets.reference;
  9884. var round = Math.round,
  9885. floor = Math.floor;
  9886. var noRound = function noRound(v) {
  9887. return v;
  9888. };
  9889. var referenceWidth = round(reference.width);
  9890. var popperWidth = round(popper.width);
  9891. var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
  9892. var isVariation = data.placement.indexOf('-') !== -1;
  9893. var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
  9894. var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;
  9895. var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
  9896. var verticalToInteger = !shouldRound ? noRound : round;
  9897. return {
  9898. left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),
  9899. top: verticalToInteger(popper.top),
  9900. bottom: verticalToInteger(popper.bottom),
  9901. right: horizontalToInteger(popper.right)
  9902. };
  9903. }
  9904. var isFirefox = isBrowser && /Firefox/i.test(navigator.userAgent);
  9905. /**
  9906. * @function
  9907. * @memberof Modifiers
  9908. * @argument {Object} data - The data object generated by `update` method
  9909. * @argument {Object} options - Modifiers configuration and options
  9910. * @returns {Object} The data object, properly modified
  9911. */
  9912. function computeStyle(data, options) {
  9913. var x = options.x,
  9914. y = options.y;
  9915. var popper = data.offsets.popper;
  9916. // Remove this legacy support in Popper.js v2
  9917. var legacyGpuAccelerationOption = find(data.instance.modifiers, function (modifier) {
  9918. return modifier.name === 'applyStyle';
  9919. }).gpuAcceleration;
  9920. if (legacyGpuAccelerationOption !== undefined) {
  9921. console.warn('WARNING: `gpuAcceleration` option moved to `computeStyle` modifier and will not be supported in future versions of Popper.js!');
  9922. }
  9923. var gpuAcceleration = legacyGpuAccelerationOption !== undefined ? legacyGpuAccelerationOption : options.gpuAcceleration;
  9924. var offsetParent = getOffsetParent(data.instance.popper);
  9925. var offsetParentRect = getBoundingClientRect(offsetParent);
  9926. // Styles
  9927. var styles = {
  9928. position: popper.position
  9929. };
  9930. var offsets = getRoundedOffsets(data, window.devicePixelRatio < 2 || !isFirefox);
  9931. var sideA = x === 'bottom' ? 'top' : 'bottom';
  9932. var sideB = y === 'right' ? 'left' : 'right';
  9933. // if gpuAcceleration is set to `true` and transform is supported,
  9934. // we use `translate3d` to apply the position to the popper we
  9935. // automatically use the supported prefixed version if needed
  9936. var prefixedProperty = getSupportedPropertyName('transform');
  9937. // now, let's make a step back and look at this code closely (wtf?)
  9938. // If the content of the popper grows once it's been positioned, it
  9939. // may happen that the popper gets misplaced because of the new content
  9940. // overflowing its reference element
  9941. // To avoid this problem, we provide two options (x and y), which allow
  9942. // the consumer to define the offset origin.
  9943. // If we position a popper on top of a reference element, we can set
  9944. // `x` to `top` to make the popper grow towards its top instead of
  9945. // its bottom.
  9946. var left = void 0,
  9947. top = void 0;
  9948. if (sideA === 'bottom') {
  9949. // when offsetParent is <html> the positioning is relative to the bottom of the screen (excluding the scrollbar)
  9950. // and not the bottom of the html element
  9951. if (offsetParent.nodeName === 'HTML') {
  9952. top = -offsetParent.clientHeight + offsets.bottom;
  9953. } else {
  9954. top = -offsetParentRect.height + offsets.bottom;
  9955. }
  9956. } else {
  9957. top = offsets.top;
  9958. }
  9959. if (sideB === 'right') {
  9960. if (offsetParent.nodeName === 'HTML') {
  9961. left = -offsetParent.clientWidth + offsets.right;
  9962. } else {
  9963. left = -offsetParentRect.width + offsets.right;
  9964. }
  9965. } else {
  9966. left = offsets.left;
  9967. }
  9968. if (gpuAcceleration && prefixedProperty) {
  9969. styles[prefixedProperty] = 'translate3d(' + left + 'px, ' + top + 'px, 0)';
  9970. styles[sideA] = 0;
  9971. styles[sideB] = 0;
  9972. styles.willChange = 'transform';
  9973. } else {
  9974. // othwerise, we use the standard `top`, `left`, `bottom` and `right` properties
  9975. var invertTop = sideA === 'bottom' ? -1 : 1;
  9976. var invertLeft = sideB === 'right' ? -1 : 1;
  9977. styles[sideA] = top * invertTop;
  9978. styles[sideB] = left * invertLeft;
  9979. styles.willChange = sideA + ', ' + sideB;
  9980. }
  9981. // Attributes
  9982. var attributes = {
  9983. 'x-placement': data.placement
  9984. };
  9985. // Update `data` attributes, styles and arrowStyles
  9986. data.attributes = _extends({}, attributes, data.attributes);
  9987. data.styles = _extends({}, styles, data.styles);
  9988. data.arrowStyles = _extends({}, data.offsets.arrow, data.arrowStyles);
  9989. return data;
  9990. }
  9991. /**
  9992. * Helper used to know if the given modifier depends from another one.<br />
  9993. * It checks if the needed modifier is listed and enabled.
  9994. * @method
  9995. * @memberof Popper.Utils
  9996. * @param {Array} modifiers - list of modifiers
  9997. * @param {String} requestingName - name of requesting modifier
  9998. * @param {String} requestedName - name of requested modifier
  9999. * @returns {Boolean}
  10000. */
  10001. function isModifierRequired(modifiers, requestingName, requestedName) {
  10002. var requesting = find(modifiers, function (_ref) {
  10003. var name = _ref.name;
  10004. return name === requestingName;
  10005. });
  10006. var isRequired = !!requesting && modifiers.some(function (modifier) {
  10007. return modifier.name === requestedName && modifier.enabled && modifier.order < requesting.order;
  10008. });
  10009. if (!isRequired) {
  10010. var _requesting = '`' + requestingName + '`';
  10011. var requested = '`' + requestedName + '`';
  10012. console.warn(requested + ' modifier is required by ' + _requesting + ' modifier in order to work, be sure to include it before ' + _requesting + '!');
  10013. }
  10014. return isRequired;
  10015. }
  10016. /**
  10017. * @function
  10018. * @memberof Modifiers
  10019. * @argument {Object} data - The data object generated by update method
  10020. * @argument {Object} options - Modifiers configuration and options
  10021. * @returns {Object} The data object, properly modified
  10022. */
  10023. function arrow(data, options) {
  10024. var _data$offsets$arrow;
  10025. // arrow depends on keepTogether in order to work
  10026. if (!isModifierRequired(data.instance.modifiers, 'arrow', 'keepTogether')) {
  10027. return data;
  10028. }
  10029. var arrowElement = options.element;
  10030. // if arrowElement is a string, suppose it's a CSS selector
  10031. if (typeof arrowElement === 'string') {
  10032. arrowElement = data.instance.popper.querySelector(arrowElement);
  10033. // if arrowElement is not found, don't run the modifier
  10034. if (!arrowElement) {
  10035. return data;
  10036. }
  10037. } else {
  10038. // if the arrowElement isn't a query selector we must check that the
  10039. // provided DOM node is child of its popper node
  10040. if (!data.instance.popper.contains(arrowElement)) {
  10041. console.warn('WARNING: `arrow.element` must be child of its popper element!');
  10042. return data;
  10043. }
  10044. }
  10045. var placement = data.placement.split('-')[0];
  10046. var _data$offsets = data.offsets,
  10047. popper = _data$offsets.popper,
  10048. reference = _data$offsets.reference;
  10049. var isVertical = ['left', 'right'].indexOf(placement) !== -1;
  10050. var len = isVertical ? 'height' : 'width';
  10051. var sideCapitalized = isVertical ? 'Top' : 'Left';
  10052. var side = sideCapitalized.toLowerCase();
  10053. var altSide = isVertical ? 'left' : 'top';
  10054. var opSide = isVertical ? 'bottom' : 'right';
  10055. var arrowElementSize = getOuterSizes(arrowElement)[len];
  10056. //
  10057. // extends keepTogether behavior making sure the popper and its
  10058. // reference have enough pixels in conjunction
  10059. //
  10060. // top/left side
  10061. if (reference[opSide] - arrowElementSize < popper[side]) {
  10062. data.offsets.popper[side] -= popper[side] - (reference[opSide] - arrowElementSize);
  10063. }
  10064. // bottom/right side
  10065. if (reference[side] + arrowElementSize > popper[opSide]) {
  10066. data.offsets.popper[side] += reference[side] + arrowElementSize - popper[opSide];
  10067. }
  10068. data.offsets.popper = getClientRect(data.offsets.popper);
  10069. // compute center of the popper
  10070. var center = reference[side] + reference[len] / 2 - arrowElementSize / 2;
  10071. // Compute the sideValue using the updated popper offsets
  10072. // take popper margin in account because we don't have this info available
  10073. var css = getStyleComputedProperty(data.instance.popper);
  10074. var popperMarginSide = parseFloat(css['margin' + sideCapitalized], 10);
  10075. var popperBorderSide = parseFloat(css['border' + sideCapitalized + 'Width'], 10);
  10076. var sideValue = center - data.offsets.popper[side] - popperMarginSide - popperBorderSide;
  10077. // prevent arrowElement from being placed not contiguously to its popper
  10078. sideValue = Math.max(Math.min(popper[len] - arrowElementSize, sideValue), 0);
  10079. data.arrowElement = arrowElement;
  10080. data.offsets.arrow = (_data$offsets$arrow = {}, defineProperty(_data$offsets$arrow, side, Math.round(sideValue)), defineProperty(_data$offsets$arrow, altSide, ''), _data$offsets$arrow);
  10081. return data;
  10082. }
  10083. /**
  10084. * Get the opposite placement variation of the given one
  10085. * @method
  10086. * @memberof Popper.Utils
  10087. * @argument {String} placement variation
  10088. * @returns {String} flipped placement variation
  10089. */
  10090. function getOppositeVariation(variation) {
  10091. if (variation === 'end') {
  10092. return 'start';
  10093. } else if (variation === 'start') {
  10094. return 'end';
  10095. }
  10096. return variation;
  10097. }
  10098. /**
  10099. * List of accepted placements to use as values of the `placement` option.<br />
  10100. * Valid placements are:
  10101. * - `auto`
  10102. * - `top`
  10103. * - `right`
  10104. * - `bottom`
  10105. * - `left`
  10106. *
  10107. * Each placement can have a variation from this list:
  10108. * - `-start`
  10109. * - `-end`
  10110. *
  10111. * Variations are interpreted easily if you think of them as the left to right
  10112. * written languages. Horizontally (`top` and `bottom`), `start` is left and `end`
  10113. * is right.<br />
  10114. * Vertically (`left` and `right`), `start` is top and `end` is bottom.
  10115. *
  10116. * Some valid examples are:
  10117. * - `top-end` (on top of reference, right aligned)
  10118. * - `right-start` (on right of reference, top aligned)
  10119. * - `bottom` (on bottom, centered)
  10120. * - `auto-end` (on the side with more space available, alignment depends by placement)
  10121. *
  10122. * @static
  10123. * @type {Array}
  10124. * @enum {String}
  10125. * @readonly
  10126. * @method placements
  10127. * @memberof Popper
  10128. */
  10129. var placements = ['auto-start', 'auto', 'auto-end', 'top-start', 'top', 'top-end', 'right-start', 'right', 'right-end', 'bottom-end', 'bottom', 'bottom-start', 'left-end', 'left', 'left-start'];
  10130. // Get rid of `auto` `auto-start` and `auto-end`
  10131. var validPlacements = placements.slice(3);
  10132. /**
  10133. * Given an initial placement, returns all the subsequent placements
  10134. * clockwise (or counter-clockwise).
  10135. *
  10136. * @method
  10137. * @memberof Popper.Utils
  10138. * @argument {String} placement - A valid placement (it accepts variations)
  10139. * @argument {Boolean} counter - Set to true to walk the placements counterclockwise
  10140. * @returns {Array} placements including their variations
  10141. */
  10142. function clockwise(placement) {
  10143. var counter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  10144. var index = validPlacements.indexOf(placement);
  10145. var arr = validPlacements.slice(index + 1).concat(validPlacements.slice(0, index));
  10146. return counter ? arr.reverse() : arr;
  10147. }
  10148. var BEHAVIORS = {
  10149. FLIP: 'flip',
  10150. CLOCKWISE: 'clockwise',
  10151. COUNTERCLOCKWISE: 'counterclockwise'
  10152. };
  10153. /**
  10154. * @function
  10155. * @memberof Modifiers
  10156. * @argument {Object} data - The data object generated by update method
  10157. * @argument {Object} options - Modifiers configuration and options
  10158. * @returns {Object} The data object, properly modified
  10159. */
  10160. function flip(data, options) {
  10161. // if `inner` modifier is enabled, we can't use the `flip` modifier
  10162. if (isModifierEnabled(data.instance.modifiers, 'inner')) {
  10163. return data;
  10164. }
  10165. if (data.flipped && data.placement === data.originalPlacement) {
  10166. // seems like flip is trying to loop, probably there's not enough space on any of the flippable sides
  10167. return data;
  10168. }
  10169. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, options.boundariesElement, data.positionFixed);
  10170. var placement = data.placement.split('-')[0];
  10171. var placementOpposite = getOppositePlacement(placement);
  10172. var variation = data.placement.split('-')[1] || '';
  10173. var flipOrder = [];
  10174. switch (options.behavior) {
  10175. case BEHAVIORS.FLIP:
  10176. flipOrder = [placement, placementOpposite];
  10177. break;
  10178. case BEHAVIORS.CLOCKWISE:
  10179. flipOrder = clockwise(placement);
  10180. break;
  10181. case BEHAVIORS.COUNTERCLOCKWISE:
  10182. flipOrder = clockwise(placement, true);
  10183. break;
  10184. default:
  10185. flipOrder = options.behavior;
  10186. }
  10187. flipOrder.forEach(function (step, index) {
  10188. if (placement !== step || flipOrder.length === index + 1) {
  10189. return data;
  10190. }
  10191. placement = data.placement.split('-')[0];
  10192. placementOpposite = getOppositePlacement(placement);
  10193. var popperOffsets = data.offsets.popper;
  10194. var refOffsets = data.offsets.reference;
  10195. // using floor because the reference offsets may contain decimals we are not going to consider here
  10196. var floor = Math.floor;
  10197. var overlapsRef = placement === 'left' && floor(popperOffsets.right) > floor(refOffsets.left) || placement === 'right' && floor(popperOffsets.left) < floor(refOffsets.right) || placement === 'top' && floor(popperOffsets.bottom) > floor(refOffsets.top) || placement === 'bottom' && floor(popperOffsets.top) < floor(refOffsets.bottom);
  10198. var overflowsLeft = floor(popperOffsets.left) < floor(boundaries.left);
  10199. var overflowsRight = floor(popperOffsets.right) > floor(boundaries.right);
  10200. var overflowsTop = floor(popperOffsets.top) < floor(boundaries.top);
  10201. var overflowsBottom = floor(popperOffsets.bottom) > floor(boundaries.bottom);
  10202. var overflowsBoundaries = placement === 'left' && overflowsLeft || placement === 'right' && overflowsRight || placement === 'top' && overflowsTop || placement === 'bottom' && overflowsBottom;
  10203. // flip the variation if required
  10204. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  10205. // flips variation if reference element overflows boundaries
  10206. var flippedVariationByRef = !!options.flipVariations && (isVertical && variation === 'start' && overflowsLeft || isVertical && variation === 'end' && overflowsRight || !isVertical && variation === 'start' && overflowsTop || !isVertical && variation === 'end' && overflowsBottom);
  10207. // flips variation if popper content overflows boundaries
  10208. var flippedVariationByContent = !!options.flipVariationsByContent && (isVertical && variation === 'start' && overflowsRight || isVertical && variation === 'end' && overflowsLeft || !isVertical && variation === 'start' && overflowsBottom || !isVertical && variation === 'end' && overflowsTop);
  10209. var flippedVariation = flippedVariationByRef || flippedVariationByContent;
  10210. if (overlapsRef || overflowsBoundaries || flippedVariation) {
  10211. // this boolean to detect any flip loop
  10212. data.flipped = true;
  10213. if (overlapsRef || overflowsBoundaries) {
  10214. placement = flipOrder[index + 1];
  10215. }
  10216. if (flippedVariation) {
  10217. variation = getOppositeVariation(variation);
  10218. }
  10219. data.placement = placement + (variation ? '-' + variation : '');
  10220. // this object contains `position`, we want to preserve it along with
  10221. // any additional property we may add in the future
  10222. data.offsets.popper = _extends({}, data.offsets.popper, getPopperOffsets(data.instance.popper, data.offsets.reference, data.placement));
  10223. data = runModifiers(data.instance.modifiers, data, 'flip');
  10224. }
  10225. });
  10226. return data;
  10227. }
  10228. /**
  10229. * @function
  10230. * @memberof Modifiers
  10231. * @argument {Object} data - The data object generated by update method
  10232. * @argument {Object} options - Modifiers configuration and options
  10233. * @returns {Object} The data object, properly modified
  10234. */
  10235. function keepTogether(data) {
  10236. var _data$offsets = data.offsets,
  10237. popper = _data$offsets.popper,
  10238. reference = _data$offsets.reference;
  10239. var placement = data.placement.split('-')[0];
  10240. var floor = Math.floor;
  10241. var isVertical = ['top', 'bottom'].indexOf(placement) !== -1;
  10242. var side = isVertical ? 'right' : 'bottom';
  10243. var opSide = isVertical ? 'left' : 'top';
  10244. var measurement = isVertical ? 'width' : 'height';
  10245. if (popper[side] < floor(reference[opSide])) {
  10246. data.offsets.popper[opSide] = floor(reference[opSide]) - popper[measurement];
  10247. }
  10248. if (popper[opSide] > floor(reference[side])) {
  10249. data.offsets.popper[opSide] = floor(reference[side]);
  10250. }
  10251. return data;
  10252. }
  10253. /**
  10254. * Converts a string containing value + unit into a px value number
  10255. * @function
  10256. * @memberof {modifiers~offset}
  10257. * @private
  10258. * @argument {String} str - Value + unit string
  10259. * @argument {String} measurement - `height` or `width`
  10260. * @argument {Object} popperOffsets
  10261. * @argument {Object} referenceOffsets
  10262. * @returns {Number|String}
  10263. * Value in pixels, or original string if no values were extracted
  10264. */
  10265. function toValue(str, measurement, popperOffsets, referenceOffsets) {
  10266. // separate value from unit
  10267. var split = str.match(/((?:\-|\+)?\d*\.?\d*)(.*)/);
  10268. var value = +split[1];
  10269. var unit = split[2];
  10270. // If it's not a number it's an operator, I guess
  10271. if (!value) {
  10272. return str;
  10273. }
  10274. if (unit.indexOf('%') === 0) {
  10275. var element = void 0;
  10276. switch (unit) {
  10277. case '%p':
  10278. element = popperOffsets;
  10279. break;
  10280. case '%':
  10281. case '%r':
  10282. default:
  10283. element = referenceOffsets;
  10284. }
  10285. var rect = getClientRect(element);
  10286. return rect[measurement] / 100 * value;
  10287. } else if (unit === 'vh' || unit === 'vw') {
  10288. // if is a vh or vw, we calculate the size based on the viewport
  10289. var size = void 0;
  10290. if (unit === 'vh') {
  10291. size = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
  10292. } else {
  10293. size = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
  10294. }
  10295. return size / 100 * value;
  10296. } else {
  10297. // if is an explicit pixel unit, we get rid of the unit and keep the value
  10298. // if is an implicit unit, it's px, and we return just the value
  10299. return value;
  10300. }
  10301. }
  10302. /**
  10303. * Parse an `offset` string to extrapolate `x` and `y` numeric offsets.
  10304. * @function
  10305. * @memberof {modifiers~offset}
  10306. * @private
  10307. * @argument {String} offset
  10308. * @argument {Object} popperOffsets
  10309. * @argument {Object} referenceOffsets
  10310. * @argument {String} basePlacement
  10311. * @returns {Array} a two cells array with x and y offsets in numbers
  10312. */
  10313. function parseOffset(offset, popperOffsets, referenceOffsets, basePlacement) {
  10314. var offsets = [0, 0];
  10315. // Use height if placement is left or right and index is 0 otherwise use width
  10316. // in this way the first offset will use an axis and the second one
  10317. // will use the other one
  10318. var useHeight = ['right', 'left'].indexOf(basePlacement) !== -1;
  10319. // Split the offset string to obtain a list of values and operands
  10320. // The regex addresses values with the plus or minus sign in front (+10, -20, etc)
  10321. var fragments = offset.split(/(\+|\-)/).map(function (frag) {
  10322. return frag.trim();
  10323. });
  10324. // Detect if the offset string contains a pair of values or a single one
  10325. // they could be separated by comma or space
  10326. var divider = fragments.indexOf(find(fragments, function (frag) {
  10327. return frag.search(/,|\s/) !== -1;
  10328. }));
  10329. if (fragments[divider] && fragments[divider].indexOf(',') === -1) {
  10330. console.warn('Offsets separated by white space(s) are deprecated, use a comma (,) instead.');
  10331. }
  10332. // If divider is found, we divide the list of values and operands to divide
  10333. // them by ofset X and Y.
  10334. var splitRegex = /\s*,\s*|\s+/;
  10335. var ops = divider !== -1 ? [fragments.slice(0, divider).concat([fragments[divider].split(splitRegex)[0]]), [fragments[divider].split(splitRegex)[1]].concat(fragments.slice(divider + 1))] : [fragments];
  10336. // Convert the values with units to absolute pixels to allow our computations
  10337. ops = ops.map(function (op, index) {
  10338. // Most of the units rely on the orientation of the popper
  10339. var measurement = (index === 1 ? !useHeight : useHeight) ? 'height' : 'width';
  10340. var mergeWithPrevious = false;
  10341. return op
  10342. // This aggregates any `+` or `-` sign that aren't considered operators
  10343. // e.g.: 10 + +5 => [10, +, +5]
  10344. .reduce(function (a, b) {
  10345. if (a[a.length - 1] === '' && ['+', '-'].indexOf(b) !== -1) {
  10346. a[a.length - 1] = b;
  10347. mergeWithPrevious = true;
  10348. return a;
  10349. } else if (mergeWithPrevious) {
  10350. a[a.length - 1] += b;
  10351. mergeWithPrevious = false;
  10352. return a;
  10353. } else {
  10354. return a.concat(b);
  10355. }
  10356. }, [])
  10357. // Here we convert the string values into number values (in px)
  10358. .map(function (str) {
  10359. return toValue(str, measurement, popperOffsets, referenceOffsets);
  10360. });
  10361. });
  10362. // Loop trough the offsets arrays and execute the operations
  10363. ops.forEach(function (op, index) {
  10364. op.forEach(function (frag, index2) {
  10365. if (isNumeric(frag)) {
  10366. offsets[index] += frag * (op[index2 - 1] === '-' ? -1 : 1);
  10367. }
  10368. });
  10369. });
  10370. return offsets;
  10371. }
  10372. /**
  10373. * @function
  10374. * @memberof Modifiers
  10375. * @argument {Object} data - The data object generated by update method
  10376. * @argument {Object} options - Modifiers configuration and options
  10377. * @argument {Number|String} options.offset=0
  10378. * The offset value as described in the modifier description
  10379. * @returns {Object} The data object, properly modified
  10380. */
  10381. function offset(data, _ref) {
  10382. var offset = _ref.offset;
  10383. var placement = data.placement,
  10384. _data$offsets = data.offsets,
  10385. popper = _data$offsets.popper,
  10386. reference = _data$offsets.reference;
  10387. var basePlacement = placement.split('-')[0];
  10388. var offsets = void 0;
  10389. if (isNumeric(+offset)) {
  10390. offsets = [+offset, 0];
  10391. } else {
  10392. offsets = parseOffset(offset, popper, reference, basePlacement);
  10393. }
  10394. if (basePlacement === 'left') {
  10395. popper.top += offsets[0];
  10396. popper.left -= offsets[1];
  10397. } else if (basePlacement === 'right') {
  10398. popper.top += offsets[0];
  10399. popper.left += offsets[1];
  10400. } else if (basePlacement === 'top') {
  10401. popper.left += offsets[0];
  10402. popper.top -= offsets[1];
  10403. } else if (basePlacement === 'bottom') {
  10404. popper.left += offsets[0];
  10405. popper.top += offsets[1];
  10406. }
  10407. data.popper = popper;
  10408. return data;
  10409. }
  10410. /**
  10411. * @function
  10412. * @memberof Modifiers
  10413. * @argument {Object} data - The data object generated by `update` method
  10414. * @argument {Object} options - Modifiers configuration and options
  10415. * @returns {Object} The data object, properly modified
  10416. */
  10417. function preventOverflow(data, options) {
  10418. var boundariesElement = options.boundariesElement || getOffsetParent(data.instance.popper);
  10419. // If offsetParent is the reference element, we really want to
  10420. // go one step up and use the next offsetParent as reference to
  10421. // avoid to make this modifier completely useless and look like broken
  10422. if (data.instance.reference === boundariesElement) {
  10423. boundariesElement = getOffsetParent(boundariesElement);
  10424. }
  10425. // NOTE: DOM access here
  10426. // resets the popper's position so that the document size can be calculated excluding
  10427. // the size of the popper element itself
  10428. var transformProp = getSupportedPropertyName('transform');
  10429. var popperStyles = data.instance.popper.style; // assignment to help minification
  10430. var top = popperStyles.top,
  10431. left = popperStyles.left,
  10432. transform = popperStyles[transformProp];
  10433. popperStyles.top = '';
  10434. popperStyles.left = '';
  10435. popperStyles[transformProp] = '';
  10436. var boundaries = getBoundaries(data.instance.popper, data.instance.reference, options.padding, boundariesElement, data.positionFixed);
  10437. // NOTE: DOM access here
  10438. // restores the original style properties after the offsets have been computed
  10439. popperStyles.top = top;
  10440. popperStyles.left = left;
  10441. popperStyles[transformProp] = transform;
  10442. options.boundaries = boundaries;
  10443. var order = options.priority;
  10444. var popper = data.offsets.popper;
  10445. var check = {
  10446. primary: function primary(placement) {
  10447. var value = popper[placement];
  10448. if (popper[placement] < boundaries[placement] && !options.escapeWithReference) {
  10449. value = Math.max(popper[placement], boundaries[placement]);
  10450. }
  10451. return defineProperty({}, placement, value);
  10452. },
  10453. secondary: function secondary(placement) {
  10454. var mainSide = placement === 'right' ? 'left' : 'top';
  10455. var value = popper[mainSide];
  10456. if (popper[placement] > boundaries[placement] && !options.escapeWithReference) {
  10457. value = Math.min(popper[mainSide], boundaries[placement] - (placement === 'right' ? popper.width : popper.height));
  10458. }
  10459. return defineProperty({}, mainSide, value);
  10460. }
  10461. };
  10462. order.forEach(function (placement) {
  10463. var side = ['left', 'top'].indexOf(placement) !== -1 ? 'primary' : 'secondary';
  10464. popper = _extends({}, popper, check[side](placement));
  10465. });
  10466. data.offsets.popper = popper;
  10467. return data;
  10468. }
  10469. /**
  10470. * @function
  10471. * @memberof Modifiers
  10472. * @argument {Object} data - The data object generated by `update` method
  10473. * @argument {Object} options - Modifiers configuration and options
  10474. * @returns {Object} The data object, properly modified
  10475. */
  10476. function shift(data) {
  10477. var placement = data.placement;
  10478. var basePlacement = placement.split('-')[0];
  10479. var shiftvariation = placement.split('-')[1];
  10480. // if shift shiftvariation is specified, run the modifier
  10481. if (shiftvariation) {
  10482. var _data$offsets = data.offsets,
  10483. reference = _data$offsets.reference,
  10484. popper = _data$offsets.popper;
  10485. var isVertical = ['bottom', 'top'].indexOf(basePlacement) !== -1;
  10486. var side = isVertical ? 'left' : 'top';
  10487. var measurement = isVertical ? 'width' : 'height';
  10488. var shiftOffsets = {
  10489. start: defineProperty({}, side, reference[side]),
  10490. end: defineProperty({}, side, reference[side] + reference[measurement] - popper[measurement])
  10491. };
  10492. data.offsets.popper = _extends({}, popper, shiftOffsets[shiftvariation]);
  10493. }
  10494. return data;
  10495. }
  10496. /**
  10497. * @function
  10498. * @memberof Modifiers
  10499. * @argument {Object} data - The data object generated by update method
  10500. * @argument {Object} options - Modifiers configuration and options
  10501. * @returns {Object} The data object, properly modified
  10502. */
  10503. function hide(data) {
  10504. if (!isModifierRequired(data.instance.modifiers, 'hide', 'preventOverflow')) {
  10505. return data;
  10506. }
  10507. var refRect = data.offsets.reference;
  10508. var bound = find(data.instance.modifiers, function (modifier) {
  10509. return modifier.name === 'preventOverflow';
  10510. }).boundaries;
  10511. if (refRect.bottom < bound.top || refRect.left > bound.right || refRect.top > bound.bottom || refRect.right < bound.left) {
  10512. // Avoid unnecessary DOM access if visibility hasn't changed
  10513. if (data.hide === true) {
  10514. return data;
  10515. }
  10516. data.hide = true;
  10517. data.attributes['x-out-of-boundaries'] = '';
  10518. } else {
  10519. // Avoid unnecessary DOM access if visibility hasn't changed
  10520. if (data.hide === false) {
  10521. return data;
  10522. }
  10523. data.hide = false;
  10524. data.attributes['x-out-of-boundaries'] = false;
  10525. }
  10526. return data;
  10527. }
  10528. /**
  10529. * @function
  10530. * @memberof Modifiers
  10531. * @argument {Object} data - The data object generated by `update` method
  10532. * @argument {Object} options - Modifiers configuration and options
  10533. * @returns {Object} The data object, properly modified
  10534. */
  10535. function inner(data) {
  10536. var placement = data.placement;
  10537. var basePlacement = placement.split('-')[0];
  10538. var _data$offsets = data.offsets,
  10539. popper = _data$offsets.popper,
  10540. reference = _data$offsets.reference;
  10541. var isHoriz = ['left', 'right'].indexOf(basePlacement) !== -1;
  10542. var subtractLength = ['top', 'left'].indexOf(basePlacement) === -1;
  10543. popper[isHoriz ? 'left' : 'top'] = reference[basePlacement] - (subtractLength ? popper[isHoriz ? 'width' : 'height'] : 0);
  10544. data.placement = getOppositePlacement(placement);
  10545. data.offsets.popper = getClientRect(popper);
  10546. return data;
  10547. }
  10548. /**
  10549. * Modifier function, each modifier can have a function of this type assigned
  10550. * to its `fn` property.<br />
  10551. * These functions will be called on each update, this means that you must
  10552. * make sure they are performant enough to avoid performance bottlenecks.
  10553. *
  10554. * @function ModifierFn
  10555. * @argument {dataObject} data - The data object generated by `update` method
  10556. * @argument {Object} options - Modifiers configuration and options
  10557. * @returns {dataObject} The data object, properly modified
  10558. */
  10559. /**
  10560. * Modifiers are plugins used to alter the behavior of your poppers.<br />
  10561. * Popper.js uses a set of 9 modifiers to provide all the basic functionalities
  10562. * needed by the library.
  10563. *
  10564. * Usually you don't want to override the `order`, `fn` and `onLoad` props.
  10565. * All the other properties are configurations that could be tweaked.
  10566. * @namespace modifiers
  10567. */
  10568. var modifiers = {
  10569. /**
  10570. * Modifier used to shift the popper on the start or end of its reference
  10571. * element.<br />
  10572. * It will read the variation of the `placement` property.<br />
  10573. * It can be one either `-end` or `-start`.
  10574. * @memberof modifiers
  10575. * @inner
  10576. */
  10577. shift: {
  10578. /** @prop {number} order=100 - Index used to define the order of execution */
  10579. order: 100,
  10580. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10581. enabled: true,
  10582. /** @prop {ModifierFn} */
  10583. fn: shift
  10584. },
  10585. /**
  10586. * The `offset` modifier can shift your popper on both its axis.
  10587. *
  10588. * It accepts the following units:
  10589. * - `px` or unit-less, interpreted as pixels
  10590. * - `%` or `%r`, percentage relative to the length of the reference element
  10591. * - `%p`, percentage relative to the length of the popper element
  10592. * - `vw`, CSS viewport width unit
  10593. * - `vh`, CSS viewport height unit
  10594. *
  10595. * For length is intended the main axis relative to the placement of the popper.<br />
  10596. * This means that if the placement is `top` or `bottom`, the length will be the
  10597. * `width`. In case of `left` or `right`, it will be the `height`.
  10598. *
  10599. * You can provide a single value (as `Number` or `String`), or a pair of values
  10600. * as `String` divided by a comma or one (or more) white spaces.<br />
  10601. * The latter is a deprecated method because it leads to confusion and will be
  10602. * removed in v2.<br />
  10603. * Additionally, it accepts additions and subtractions between different units.
  10604. * Note that multiplications and divisions aren't supported.
  10605. *
  10606. * Valid examples are:
  10607. * ```
  10608. * 10
  10609. * '10%'
  10610. * '10, 10'
  10611. * '10%, 10'
  10612. * '10 + 10%'
  10613. * '10 - 5vh + 3%'
  10614. * '-10px + 5vh, 5px - 6%'
  10615. * ```
  10616. * > **NB**: If you desire to apply offsets to your poppers in a way that may make them overlap
  10617. * > with their reference element, unfortunately, you will have to disable the `flip` modifier.
  10618. * > You can read more on this at this [issue](https://github.com/FezVrasta/popper.js/issues/373).
  10619. *
  10620. * @memberof modifiers
  10621. * @inner
  10622. */
  10623. offset: {
  10624. /** @prop {number} order=200 - Index used to define the order of execution */
  10625. order: 200,
  10626. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10627. enabled: true,
  10628. /** @prop {ModifierFn} */
  10629. fn: offset,
  10630. /** @prop {Number|String} offset=0
  10631. * The offset value as described in the modifier description
  10632. */
  10633. offset: 0
  10634. },
  10635. /**
  10636. * Modifier used to prevent the popper from being positioned outside the boundary.
  10637. *
  10638. * A scenario exists where the reference itself is not within the boundaries.<br />
  10639. * We can say it has "escaped the boundaries" — or just "escaped".<br />
  10640. * In this case we need to decide whether the popper should either:
  10641. *
  10642. * - detach from the reference and remain "trapped" in the boundaries, or
  10643. * - if it should ignore the boundary and "escape with its reference"
  10644. *
  10645. * When `escapeWithReference` is set to`true` and reference is completely
  10646. * outside its boundaries, the popper will overflow (or completely leave)
  10647. * the boundaries in order to remain attached to the edge of the reference.
  10648. *
  10649. * @memberof modifiers
  10650. * @inner
  10651. */
  10652. preventOverflow: {
  10653. /** @prop {number} order=300 - Index used to define the order of execution */
  10654. order: 300,
  10655. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10656. enabled: true,
  10657. /** @prop {ModifierFn} */
  10658. fn: preventOverflow,
  10659. /**
  10660. * @prop {Array} [priority=['left','right','top','bottom']]
  10661. * Popper will try to prevent overflow following these priorities by default,
  10662. * then, it could overflow on the left and on top of the `boundariesElement`
  10663. */
  10664. priority: ['left', 'right', 'top', 'bottom'],
  10665. /**
  10666. * @prop {number} padding=5
  10667. * Amount of pixel used to define a minimum distance between the boundaries
  10668. * and the popper. This makes sure the popper always has a little padding
  10669. * between the edges of its container
  10670. */
  10671. padding: 5,
  10672. /**
  10673. * @prop {String|HTMLElement} boundariesElement='scrollParent'
  10674. * Boundaries used by the modifier. Can be `scrollParent`, `window`,
  10675. * `viewport` or any DOM element.
  10676. */
  10677. boundariesElement: 'scrollParent'
  10678. },
  10679. /**
  10680. * Modifier used to make sure the reference and its popper stay near each other
  10681. * without leaving any gap between the two. Especially useful when the arrow is
  10682. * enabled and you want to ensure that it points to its reference element.
  10683. * It cares only about the first axis. You can still have poppers with margin
  10684. * between the popper and its reference element.
  10685. * @memberof modifiers
  10686. * @inner
  10687. */
  10688. keepTogether: {
  10689. /** @prop {number} order=400 - Index used to define the order of execution */
  10690. order: 400,
  10691. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10692. enabled: true,
  10693. /** @prop {ModifierFn} */
  10694. fn: keepTogether
  10695. },
  10696. /**
  10697. * This modifier is used to move the `arrowElement` of the popper to make
  10698. * sure it is positioned between the reference element and its popper element.
  10699. * It will read the outer size of the `arrowElement` node to detect how many
  10700. * pixels of conjunction are needed.
  10701. *
  10702. * It has no effect if no `arrowElement` is provided.
  10703. * @memberof modifiers
  10704. * @inner
  10705. */
  10706. arrow: {
  10707. /** @prop {number} order=500 - Index used to define the order of execution */
  10708. order: 500,
  10709. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10710. enabled: true,
  10711. /** @prop {ModifierFn} */
  10712. fn: arrow,
  10713. /** @prop {String|HTMLElement} element='[x-arrow]' - Selector or node used as arrow */
  10714. element: '[x-arrow]'
  10715. },
  10716. /**
  10717. * Modifier used to flip the popper's placement when it starts to overlap its
  10718. * reference element.
  10719. *
  10720. * Requires the `preventOverflow` modifier before it in order to work.
  10721. *
  10722. * **NOTE:** this modifier will interrupt the current update cycle and will
  10723. * restart it if it detects the need to flip the placement.
  10724. * @memberof modifiers
  10725. * @inner
  10726. */
  10727. flip: {
  10728. /** @prop {number} order=600 - Index used to define the order of execution */
  10729. order: 600,
  10730. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10731. enabled: true,
  10732. /** @prop {ModifierFn} */
  10733. fn: flip,
  10734. /**
  10735. * @prop {String|Array} behavior='flip'
  10736. * The behavior used to change the popper's placement. It can be one of
  10737. * `flip`, `clockwise`, `counterclockwise` or an array with a list of valid
  10738. * placements (with optional variations)
  10739. */
  10740. behavior: 'flip',
  10741. /**
  10742. * @prop {number} padding=5
  10743. * The popper will flip if it hits the edges of the `boundariesElement`
  10744. */
  10745. padding: 5,
  10746. /**
  10747. * @prop {String|HTMLElement} boundariesElement='viewport'
  10748. * The element which will define the boundaries of the popper position.
  10749. * The popper will never be placed outside of the defined boundaries
  10750. * (except if `keepTogether` is enabled)
  10751. */
  10752. boundariesElement: 'viewport',
  10753. /**
  10754. * @prop {Boolean} flipVariations=false
  10755. * The popper will switch placement variation between `-start` and `-end` when
  10756. * the reference element overlaps its boundaries.
  10757. *
  10758. * The original placement should have a set variation.
  10759. */
  10760. flipVariations: false,
  10761. /**
  10762. * @prop {Boolean} flipVariationsByContent=false
  10763. * The popper will switch placement variation between `-start` and `-end` when
  10764. * the popper element overlaps its reference boundaries.
  10765. *
  10766. * The original placement should have a set variation.
  10767. */
  10768. flipVariationsByContent: false
  10769. },
  10770. /**
  10771. * Modifier used to make the popper flow toward the inner of the reference element.
  10772. * By default, when this modifier is disabled, the popper will be placed outside
  10773. * the reference element.
  10774. * @memberof modifiers
  10775. * @inner
  10776. */
  10777. inner: {
  10778. /** @prop {number} order=700 - Index used to define the order of execution */
  10779. order: 700,
  10780. /** @prop {Boolean} enabled=false - Whether the modifier is enabled or not */
  10781. enabled: false,
  10782. /** @prop {ModifierFn} */
  10783. fn: inner
  10784. },
  10785. /**
  10786. * Modifier used to hide the popper when its reference element is outside of the
  10787. * popper boundaries. It will set a `x-out-of-boundaries` attribute which can
  10788. * be used to hide with a CSS selector the popper when its reference is
  10789. * out of boundaries.
  10790. *
  10791. * Requires the `preventOverflow` modifier before it in order to work.
  10792. * @memberof modifiers
  10793. * @inner
  10794. */
  10795. hide: {
  10796. /** @prop {number} order=800 - Index used to define the order of execution */
  10797. order: 800,
  10798. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10799. enabled: true,
  10800. /** @prop {ModifierFn} */
  10801. fn: hide
  10802. },
  10803. /**
  10804. * Computes the style that will be applied to the popper element to gets
  10805. * properly positioned.
  10806. *
  10807. * Note that this modifier will not touch the DOM, it just prepares the styles
  10808. * so that `applyStyle` modifier can apply it. This separation is useful
  10809. * in case you need to replace `applyStyle` with a custom implementation.
  10810. *
  10811. * This modifier has `850` as `order` value to maintain backward compatibility
  10812. * with previous versions of Popper.js. Expect the modifiers ordering method
  10813. * to change in future major versions of the library.
  10814. *
  10815. * @memberof modifiers
  10816. * @inner
  10817. */
  10818. computeStyle: {
  10819. /** @prop {number} order=850 - Index used to define the order of execution */
  10820. order: 850,
  10821. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10822. enabled: true,
  10823. /** @prop {ModifierFn} */
  10824. fn: computeStyle,
  10825. /**
  10826. * @prop {Boolean} gpuAcceleration=true
  10827. * If true, it uses the CSS 3D transformation to position the popper.
  10828. * Otherwise, it will use the `top` and `left` properties
  10829. */
  10830. gpuAcceleration: true,
  10831. /**
  10832. * @prop {string} [x='bottom']
  10833. * Where to anchor the X axis (`bottom` or `top`). AKA X offset origin.
  10834. * Change this if your popper should grow in a direction different from `bottom`
  10835. */
  10836. x: 'bottom',
  10837. /**
  10838. * @prop {string} [x='left']
  10839. * Where to anchor the Y axis (`left` or `right`). AKA Y offset origin.
  10840. * Change this if your popper should grow in a direction different from `right`
  10841. */
  10842. y: 'right'
  10843. },
  10844. /**
  10845. * Applies the computed styles to the popper element.
  10846. *
  10847. * All the DOM manipulations are limited to this modifier. This is useful in case
  10848. * you want to integrate Popper.js inside a framework or view library and you
  10849. * want to delegate all the DOM manipulations to it.
  10850. *
  10851. * Note that if you disable this modifier, you must make sure the popper element
  10852. * has its position set to `absolute` before Popper.js can do its work!
  10853. *
  10854. * Just disable this modifier and define your own to achieve the desired effect.
  10855. *
  10856. * @memberof modifiers
  10857. * @inner
  10858. */
  10859. applyStyle: {
  10860. /** @prop {number} order=900 - Index used to define the order of execution */
  10861. order: 900,
  10862. /** @prop {Boolean} enabled=true - Whether the modifier is enabled or not */
  10863. enabled: true,
  10864. /** @prop {ModifierFn} */
  10865. fn: applyStyle,
  10866. /** @prop {Function} */
  10867. onLoad: applyStyleOnLoad,
  10868. /**
  10869. * @deprecated since version 1.10.0, the property moved to `computeStyle` modifier
  10870. * @prop {Boolean} gpuAcceleration=true
  10871. * If true, it uses the CSS 3D transformation to position the popper.
  10872. * Otherwise, it will use the `top` and `left` properties
  10873. */
  10874. gpuAcceleration: undefined
  10875. }
  10876. };
  10877. /**
  10878. * The `dataObject` is an object containing all the information used by Popper.js.
  10879. * This object is passed to modifiers and to the `onCreate` and `onUpdate` callbacks.
  10880. * @name dataObject
  10881. * @property {Object} data.instance The Popper.js instance
  10882. * @property {String} data.placement Placement applied to popper
  10883. * @property {String} data.originalPlacement Placement originally defined on init
  10884. * @property {Boolean} data.flipped True if popper has been flipped by flip modifier
  10885. * @property {Boolean} data.hide True if the reference element is out of boundaries, useful to know when to hide the popper
  10886. * @property {HTMLElement} data.arrowElement Node used as arrow by arrow modifier
  10887. * @property {Object} data.styles Any CSS property defined here will be applied to the popper. It expects the JavaScript nomenclature (eg. `marginBottom`)
  10888. * @property {Object} data.arrowStyles Any CSS property defined here will be applied to the popper arrow. It expects the JavaScript nomenclature (eg. `marginBottom`)
  10889. * @property {Object} data.boundaries Offsets of the popper boundaries
  10890. * @property {Object} data.offsets The measurements of popper, reference and arrow elements
  10891. * @property {Object} data.offsets.popper `top`, `left`, `width`, `height` values
  10892. * @property {Object} data.offsets.reference `top`, `left`, `width`, `height` values
  10893. * @property {Object} data.offsets.arrow] `top` and `left` offsets, only one of them will be different from 0
  10894. */
  10895. /**
  10896. * Default options provided to Popper.js constructor.<br />
  10897. * These can be overridden using the `options` argument of Popper.js.<br />
  10898. * To override an option, simply pass an object with the same
  10899. * structure of the `options` object, as the 3rd argument. For example:
  10900. * ```
  10901. * new Popper(ref, pop, {
  10902. * modifiers: {
  10903. * preventOverflow: { enabled: false }
  10904. * }
  10905. * })
  10906. * ```
  10907. * @type {Object}
  10908. * @static
  10909. * @memberof Popper
  10910. */
  10911. var Defaults = {
  10912. /**
  10913. * Popper's placement.
  10914. * @prop {Popper.placements} placement='bottom'
  10915. */
  10916. placement: 'bottom',
  10917. /**
  10918. * Set this to true if you want popper to position it self in 'fixed' mode
  10919. * @prop {Boolean} positionFixed=false
  10920. */
  10921. positionFixed: false,
  10922. /**
  10923. * Whether events (resize, scroll) are initially enabled.
  10924. * @prop {Boolean} eventsEnabled=true
  10925. */
  10926. eventsEnabled: true,
  10927. /**
  10928. * Set to true if you want to automatically remove the popper when
  10929. * you call the `destroy` method.
  10930. * @prop {Boolean} removeOnDestroy=false
  10931. */
  10932. removeOnDestroy: false,
  10933. /**
  10934. * Callback called when the popper is created.<br />
  10935. * By default, it is set to no-op.<br />
  10936. * Access Popper.js instance with `data.instance`.
  10937. * @prop {onCreate}
  10938. */
  10939. onCreate: function onCreate() {},
  10940. /**
  10941. * Callback called when the popper is updated. This callback is not called
  10942. * on the initialization/creation of the popper, but only on subsequent
  10943. * updates.<br />
  10944. * By default, it is set to no-op.<br />
  10945. * Access Popper.js instance with `data.instance`.
  10946. * @prop {onUpdate}
  10947. */
  10948. onUpdate: function onUpdate() {},
  10949. /**
  10950. * List of modifiers used to modify the offsets before they are applied to the popper.
  10951. * They provide most of the functionalities of Popper.js.
  10952. * @prop {modifiers}
  10953. */
  10954. modifiers: modifiers
  10955. };
  10956. /**
  10957. * @callback onCreate
  10958. * @param {dataObject} data
  10959. */
  10960. /**
  10961. * @callback onUpdate
  10962. * @param {dataObject} data
  10963. */
  10964. // Utils
  10965. // Methods
  10966. var Popper = function () {
  10967. /**
  10968. * Creates a new Popper.js instance.
  10969. * @class Popper
  10970. * @param {Element|referenceObject} reference - The reference element used to position the popper
  10971. * @param {Element} popper - The HTML / XML element used as the popper
  10972. * @param {Object} options - Your custom options to override the ones defined in [Defaults](#defaults)
  10973. * @return {Object} instance - The generated Popper.js instance
  10974. */
  10975. function Popper(reference, popper) {
  10976. var _this = this;
  10977. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  10978. classCallCheck(this, Popper);
  10979. this.scheduleUpdate = function () {
  10980. return requestAnimationFrame(_this.update);
  10981. };
  10982. // make update() debounced, so that it only runs at most once-per-tick
  10983. this.update = debounce(this.update.bind(this));
  10984. // with {} we create a new object with the options inside it
  10985. this.options = _extends({}, Popper.Defaults, options);
  10986. // init state
  10987. this.state = {
  10988. isDestroyed: false,
  10989. isCreated: false,
  10990. scrollParents: []
  10991. };
  10992. // get reference and popper elements (allow jQuery wrappers)
  10993. this.reference = reference && reference.jquery ? reference[0] : reference;
  10994. this.popper = popper && popper.jquery ? popper[0] : popper;
  10995. // Deep merge modifiers options
  10996. this.options.modifiers = {};
  10997. Object.keys(_extends({}, Popper.Defaults.modifiers, options.modifiers)).forEach(function (name) {
  10998. _this.options.modifiers[name] = _extends({}, Popper.Defaults.modifiers[name] || {}, options.modifiers ? options.modifiers[name] : {});
  10999. });
  11000. // Refactoring modifiers' list (Object => Array)
  11001. this.modifiers = Object.keys(this.options.modifiers).map(function (name) {
  11002. return _extends({
  11003. name: name
  11004. }, _this.options.modifiers[name]);
  11005. })
  11006. // sort the modifiers by order
  11007. .sort(function (a, b) {
  11008. return a.order - b.order;
  11009. });
  11010. // modifiers have the ability to execute arbitrary code when Popper.js get inited
  11011. // such code is executed in the same order of its modifier
  11012. // they could add new properties to their options configuration
  11013. // BE AWARE: don't add options to `options.modifiers.name` but to `modifierOptions`!
  11014. this.modifiers.forEach(function (modifierOptions) {
  11015. if (modifierOptions.enabled && isFunction(modifierOptions.onLoad)) {
  11016. modifierOptions.onLoad(_this.reference, _this.popper, _this.options, modifierOptions, _this.state);
  11017. }
  11018. });
  11019. // fire the first update to position the popper in the right place
  11020. this.update();
  11021. var eventsEnabled = this.options.eventsEnabled;
  11022. if (eventsEnabled) {
  11023. // setup event listeners, they will take care of update the position in specific situations
  11024. this.enableEventListeners();
  11025. }
  11026. this.state.eventsEnabled = eventsEnabled;
  11027. }
  11028. // We can't use class properties because they don't get listed in the
  11029. // class prototype and break stuff like Sinon stubs
  11030. createClass(Popper, [{
  11031. key: 'update',
  11032. value: function update$$1() {
  11033. return update.call(this);
  11034. }
  11035. }, {
  11036. key: 'destroy',
  11037. value: function destroy$$1() {
  11038. return destroy.call(this);
  11039. }
  11040. }, {
  11041. key: 'enableEventListeners',
  11042. value: function enableEventListeners$$1() {
  11043. return enableEventListeners.call(this);
  11044. }
  11045. }, {
  11046. key: 'disableEventListeners',
  11047. value: function disableEventListeners$$1() {
  11048. return disableEventListeners.call(this);
  11049. }
  11050. /**
  11051. * Schedules an update. It will run on the next UI update available.
  11052. * @method scheduleUpdate
  11053. * @memberof Popper
  11054. */
  11055. /**
  11056. * Collection of utilities useful when writing custom modifiers.
  11057. * Starting from version 1.7, this method is available only if you
  11058. * include `popper-utils.js` before `popper.js`.
  11059. *
  11060. * **DEPRECATION**: This way to access PopperUtils is deprecated
  11061. * and will be removed in v2! Use the PopperUtils module directly instead.
  11062. * Due to the high instability of the methods contained in Utils, we can't
  11063. * guarantee them to follow semver. Use them at your own risk!
  11064. * @static
  11065. * @private
  11066. * @type {Object}
  11067. * @deprecated since version 1.8
  11068. * @member Utils
  11069. * @memberof Popper
  11070. */
  11071. }]);
  11072. return Popper;
  11073. }();
  11074. /**
  11075. * The `referenceObject` is an object that provides an interface compatible with Popper.js
  11076. * and lets you use it as replacement of a real DOM node.<br />
  11077. * You can use this method to position a popper relatively to a set of coordinates
  11078. * in case you don't have a DOM node to use as reference.
  11079. *
  11080. * ```
  11081. * new Popper(referenceObject, popperNode);
  11082. * ```
  11083. *
  11084. * NB: This feature isn't supported in Internet Explorer 10.
  11085. * @name referenceObject
  11086. * @property {Function} data.getBoundingClientRect
  11087. * A function that returns a set of coordinates compatible with the native `getBoundingClientRect` method.
  11088. * @property {number} data.clientWidth
  11089. * An ES6 getter that will return the width of the virtual reference element.
  11090. * @property {number} data.clientHeight
  11091. * An ES6 getter that will return the height of the virtual reference element.
  11092. */
  11093. Popper.Utils = (typeof window !== 'undefined' ? window : global).PopperUtils;
  11094. Popper.placements = placements;
  11095. Popper.Defaults = Defaults;
  11096. /* harmony default export */ __webpack_exports__["default"] = (Popper);
  11097. //# sourceMappingURL=popper.js.map
  11098. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
  11099. /***/ }),
  11100. /***/ "./node_modules/siema/dist/siema.min.js":
  11101. /*!**********************************************!*\
  11102. !*** ./node_modules/siema/dist/siema.min.js ***!
  11103. \**********************************************/
  11104. /*! no static exports found */
  11105. /***/ (function(module, exports, __webpack_require__) {
  11106. !function(e,t){ true?module.exports=t():undefined}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(i[r])return i[r].exports;var n=i[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}var i={};return t.m=e,t.c=i,t.d=function(e,i,r){t.o(e,i)||Object.defineProperty(e,i,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(i,"a",i),i},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=0)}([function(e,t,i){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s=function(){function e(e,t){for(var i=0;i<t.length;i++){var r=t[i];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,i,r){return i&&e(t.prototype,i),r&&e(t,r),t}}(),l=function(){function e(t){var i=this;if(r(this,e),this.config=e.mergeSettings(t),this.selector="string"==typeof this.config.selector?document.querySelector(this.config.selector):this.config.selector,null===this.selector)throw new Error("Something wrong with your selector 😭");this.resolveSlidesNumber(),this.selectorWidth=this.selector.offsetWidth,this.innerElements=[].slice.call(this.selector.children),this.currentSlide=this.config.loop?this.config.startIndex%this.innerElements.length:Math.max(0,Math.min(this.config.startIndex,this.innerElements.length-this.perPage)),this.transformProperty=e.webkitOrNot(),["resizeHandler","touchstartHandler","touchendHandler","touchmoveHandler","mousedownHandler","mouseupHandler","mouseleaveHandler","mousemoveHandler","clickHandler"].forEach(function(e){i[e]=i[e].bind(i)}),this.init()}return s(e,[{key:"attachEvents",value:function(){window.addEventListener("resize",this.resizeHandler),this.config.draggable&&(this.pointerDown=!1,this.drag={startX:0,endX:0,startY:0,letItGo:null,preventClick:!1},this.selector.addEventListener("touchstart",this.touchstartHandler),this.selector.addEventListener("touchend",this.touchendHandler),this.selector.addEventListener("touchmove",this.touchmoveHandler),this.selector.addEventListener("mousedown",this.mousedownHandler),this.selector.addEventListener("mouseup",this.mouseupHandler),this.selector.addEventListener("mouseleave",this.mouseleaveHandler),this.selector.addEventListener("mousemove",this.mousemoveHandler),this.selector.addEventListener("click",this.clickHandler))}},{key:"detachEvents",value:function(){window.removeEventListener("resize",this.resizeHandler),this.selector.removeEventListener("touchstart",this.touchstartHandler),this.selector.removeEventListener("touchend",this.touchendHandler),this.selector.removeEventListener("touchmove",this.touchmoveHandler),this.selector.removeEventListener("mousedown",this.mousedownHandler),this.selector.removeEventListener("mouseup",this.mouseupHandler),this.selector.removeEventListener("mouseleave",this.mouseleaveHandler),this.selector.removeEventListener("mousemove",this.mousemoveHandler),this.selector.removeEventListener("click",this.clickHandler)}},{key:"init",value:function(){this.attachEvents(),this.selector.style.overflow="hidden",this.selector.style.direction=this.config.rtl?"rtl":"ltr",this.buildSliderFrame(),this.config.onInit.call(this)}},{key:"buildSliderFrame",value:function(){var e=this.selectorWidth/this.perPage,t=this.config.loop?this.innerElements.length+2*this.perPage:this.innerElements.length;this.sliderFrame=document.createElement("div"),this.sliderFrame.style.width=e*t+"px",this.enableTransition(),this.config.draggable&&(this.selector.style.cursor="-webkit-grab");var i=document.createDocumentFragment();if(this.config.loop)for(var r=this.innerElements.length-this.perPage;r<this.innerElements.length;r++){var n=this.buildSliderFrameItem(this.innerElements[r].cloneNode(!0));i.appendChild(n)}for(var s=0;s<this.innerElements.length;s++){var l=this.buildSliderFrameItem(this.innerElements[s]);i.appendChild(l)}if(this.config.loop)for(var o=0;o<this.perPage;o++){var a=this.buildSliderFrameItem(this.innerElements[o].cloneNode(!0));i.appendChild(a)}this.sliderFrame.appendChild(i),this.selector.innerHTML="",this.selector.appendChild(this.sliderFrame),this.slideToCurrent()}},{key:"buildSliderFrameItem",value:function(e){var t=document.createElement("div");return t.style.cssFloat=this.config.rtl?"right":"left",t.style.float=this.config.rtl?"right":"left",t.style.width=(this.config.loop?100/(this.innerElements.length+2*this.perPage):100/this.innerElements.length)+"%",t.appendChild(e),t}},{key:"resolveSlidesNumber",value:function(){if("number"==typeof this.config.perPage)this.perPage=this.config.perPage;else if("object"===n(this.config.perPage)){this.perPage=1;for(var e in this.config.perPage)window.innerWidth>=e&&(this.perPage=this.config.perPage[e])}}},{key:"prev",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments[1];if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;if(this.config.loop){if(this.currentSlide-e<0){this.disableTransition();var r=this.currentSlide+this.innerElements.length,n=this.perPage,s=r+n,l=(this.config.rtl?1:-1)*s*(this.selectorWidth/this.perPage),o=this.config.draggable?this.drag.endX-this.drag.startX:0;this.sliderFrame.style[this.transformProperty]="translate3d("+(l+o)+"px, 0, 0)",this.currentSlide=r-e}else this.currentSlide=this.currentSlide-e}else this.currentSlide=Math.max(this.currentSlide-e,0);i!==this.currentSlide&&(this.slideToCurrent(this.config.loop),this.config.onChange.call(this),t&&t.call(this))}}},{key:"next",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,t=arguments[1];if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;if(this.config.loop){if(this.currentSlide+e>this.innerElements.length-this.perPage){this.disableTransition();var r=this.currentSlide-this.innerElements.length,n=this.perPage,s=r+n,l=(this.config.rtl?1:-1)*s*(this.selectorWidth/this.perPage),o=this.config.draggable?this.drag.endX-this.drag.startX:0;this.sliderFrame.style[this.transformProperty]="translate3d("+(l+o)+"px, 0, 0)",this.currentSlide=r+e}else this.currentSlide=this.currentSlide+e}else this.currentSlide=Math.min(this.currentSlide+e,this.innerElements.length-this.perPage);i!==this.currentSlide&&(this.slideToCurrent(this.config.loop),this.config.onChange.call(this),t&&t.call(this))}}},{key:"disableTransition",value:function(){this.sliderFrame.style.webkitTransition="all 0ms "+this.config.easing,this.sliderFrame.style.transition="all 0ms "+this.config.easing}},{key:"enableTransition",value:function(){this.sliderFrame.style.webkitTransition="all "+this.config.duration+"ms "+this.config.easing,this.sliderFrame.style.transition="all "+this.config.duration+"ms "+this.config.easing}},{key:"goTo",value:function(e,t){if(!(this.innerElements.length<=this.perPage)){var i=this.currentSlide;this.currentSlide=this.config.loop?e%this.innerElements.length:Math.min(Math.max(e,0),this.innerElements.length-this.perPage),i!==this.currentSlide&&(this.slideToCurrent(),this.config.onChange.call(this),t&&t.call(this))}}},{key:"slideToCurrent",value:function(e){var t=this,i=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,r=(this.config.rtl?1:-1)*i*(this.selectorWidth/this.perPage);e?requestAnimationFrame(function(){requestAnimationFrame(function(){t.enableTransition(),t.sliderFrame.style[t.transformProperty]="translate3d("+r+"px, 0, 0)"})}):this.sliderFrame.style[this.transformProperty]="translate3d("+r+"px, 0, 0)"}},{key:"updateAfterDrag",value:function(){var e=(this.config.rtl?-1:1)*(this.drag.endX-this.drag.startX),t=Math.abs(e),i=this.config.multipleDrag?Math.ceil(t/(this.selectorWidth/this.perPage)):1,r=e>0&&this.currentSlide-i<0,n=e<0&&this.currentSlide+i>this.innerElements.length-this.perPage;e>0&&t>this.config.threshold&&this.innerElements.length>this.perPage?this.prev(i):e<0&&t>this.config.threshold&&this.innerElements.length>this.perPage&&this.next(i),this.slideToCurrent(r||n)}},{key:"resizeHandler",value:function(){this.resolveSlidesNumber(),this.currentSlide+this.perPage>this.innerElements.length&&(this.currentSlide=this.innerElements.length<=this.perPage?0:this.innerElements.length-this.perPage),this.selectorWidth=this.selector.offsetWidth,this.buildSliderFrame()}},{key:"clearDrag",value:function(){this.drag={startX:0,endX:0,startY:0,letItGo:null,preventClick:this.drag.preventClick}}},{key:"touchstartHandler",value:function(e){-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.target.nodeName)||(e.stopPropagation(),this.pointerDown=!0,this.drag.startX=e.touches[0].pageX,this.drag.startY=e.touches[0].pageY)}},{key:"touchendHandler",value:function(e){e.stopPropagation(),this.pointerDown=!1,this.enableTransition(),this.drag.endX&&this.updateAfterDrag(),this.clearDrag()}},{key:"touchmoveHandler",value:function(e){if(e.stopPropagation(),null===this.drag.letItGo&&(this.drag.letItGo=Math.abs(this.drag.startY-e.touches[0].pageY)<Math.abs(this.drag.startX-e.touches[0].pageX)),this.pointerDown&&this.drag.letItGo){e.preventDefault(),this.drag.endX=e.touches[0].pageX,this.sliderFrame.style.webkitTransition="all 0ms "+this.config.easing,this.sliderFrame.style.transition="all 0ms "+this.config.easing;var t=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,i=t*(this.selectorWidth/this.perPage),r=this.drag.endX-this.drag.startX,n=this.config.rtl?i+r:i-r;this.sliderFrame.style[this.transformProperty]="translate3d("+(this.config.rtl?1:-1)*n+"px, 0, 0)"}}},{key:"mousedownHandler",value:function(e){-1!==["TEXTAREA","OPTION","INPUT","SELECT"].indexOf(e.target.nodeName)||(e.preventDefault(),e.stopPropagation(),this.pointerDown=!0,this.drag.startX=e.pageX)}},{key:"mouseupHandler",value:function(e){e.stopPropagation(),this.pointerDown=!1,this.selector.style.cursor="-webkit-grab",this.enableTransition(),this.drag.endX&&this.updateAfterDrag(),this.clearDrag()}},{key:"mousemoveHandler",value:function(e){if(e.preventDefault(),this.pointerDown){"A"===e.target.nodeName&&(this.drag.preventClick=!0),this.drag.endX=e.pageX,this.selector.style.cursor="-webkit-grabbing",this.sliderFrame.style.webkitTransition="all 0ms "+this.config.easing,this.sliderFrame.style.transition="all 0ms "+this.config.easing;var t=this.config.loop?this.currentSlide+this.perPage:this.currentSlide,i=t*(this.selectorWidth/this.perPage),r=this.drag.endX-this.drag.startX,n=this.config.rtl?i+r:i-r;this.sliderFrame.style[this.transformProperty]="translate3d("+(this.config.rtl?1:-1)*n+"px, 0, 0)"}}},{key:"mouseleaveHandler",value:function(e){this.pointerDown&&(this.pointerDown=!1,this.selector.style.cursor="-webkit-grab",this.drag.endX=e.pageX,this.drag.preventClick=!1,this.enableTransition(),this.updateAfterDrag(),this.clearDrag())}},{key:"clickHandler",value:function(e){this.drag.preventClick&&e.preventDefault(),this.drag.preventClick=!1}},{key:"remove",value:function(e,t){if(e<0||e>=this.innerElements.length)throw new Error("Item to remove doesn't exist 😭");var i=e<this.currentSlide,r=this.currentSlide+this.perPage-1===e;(i||r)&&this.currentSlide--,this.innerElements.splice(e,1),this.buildSliderFrame(),t&&t.call(this)}},{key:"insert",value:function(e,t,i){if(t<0||t>this.innerElements.length+1)throw new Error("Unable to inset it at this index 😭");if(-1!==this.innerElements.indexOf(e))throw new Error("The same item in a carousel? Really? Nope 😭");var r=t<=this.currentSlide>0&&this.innerElements.length;this.currentSlide=r?this.currentSlide+1:this.currentSlide,this.innerElements.splice(t,0,e),this.buildSliderFrame(),i&&i.call(this)}},{key:"prepend",value:function(e,t){this.insert(e,0),t&&t.call(this)}},{key:"append",value:function(e,t){this.insert(e,this.innerElements.length+1),t&&t.call(this)}},{key:"destroy",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=arguments[1];if(this.detachEvents(),this.selector.style.cursor="auto",e){for(var i=document.createDocumentFragment(),r=0;r<this.innerElements.length;r++)i.appendChild(this.innerElements[r]);this.selector.innerHTML="",this.selector.appendChild(i),this.selector.removeAttribute("style")}t&&t.call(this)}}],[{key:"mergeSettings",value:function(e){var t={selector:".siema",duration:200,easing:"ease-out",perPage:1,startIndex:0,draggable:!0,multipleDrag:!0,threshold:20,loop:!1,rtl:!1,onInit:function(){},onChange:function(){}},i=e;for(var r in i)t[r]=i[r];return t}},{key:"webkitOrNot",value:function(){return"string"==typeof document.documentElement.style.transform?"transform":"WebkitTransform"}}]),e}();t.default=l,e.exports=t.default}])});
  11107. /***/ }),
  11108. /***/ "./node_modules/style-loader/lib/addStyles.js":
  11109. /*!****************************************************!*\
  11110. !*** ./node_modules/style-loader/lib/addStyles.js ***!
  11111. \****************************************************/
  11112. /*! no static exports found */
  11113. /***/ (function(module, exports, __webpack_require__) {
  11114. /*
  11115. MIT License http://www.opensource.org/licenses/mit-license.php
  11116. Author Tobias Koppers @sokra
  11117. */
  11118. var stylesInDom = {};
  11119. var memoize = function (fn) {
  11120. var memo;
  11121. return function () {
  11122. if (typeof memo === "undefined") memo = fn.apply(this, arguments);
  11123. return memo;
  11124. };
  11125. };
  11126. var isOldIE = memoize(function () {
  11127. // Test for IE <= 9 as proposed by Browserhacks
  11128. // @see http://browserhacks.com/#hack-e71d8692f65334173fee715c222cb805
  11129. // Tests for existence of standard globals is to allow style-loader
  11130. // to operate correctly into non-standard environments
  11131. // @see https://github.com/webpack-contrib/style-loader/issues/177
  11132. return window && document && document.all && !window.atob;
  11133. });
  11134. var getTarget = function (target, parent) {
  11135. if (parent){
  11136. return parent.querySelector(target);
  11137. }
  11138. return document.querySelector(target);
  11139. };
  11140. var getElement = (function (fn) {
  11141. var memo = {};
  11142. return function(target, parent) {
  11143. // If passing function in options, then use it for resolve "head" element.
  11144. // Useful for Shadow Root style i.e
  11145. // {
  11146. // insertInto: function () { return document.querySelector("#foo").shadowRoot }
  11147. // }
  11148. if (typeof target === 'function') {
  11149. return target();
  11150. }
  11151. if (typeof memo[target] === "undefined") {
  11152. var styleTarget = getTarget.call(this, target, parent);
  11153. // Special case to return head of iframe instead of iframe itself
  11154. if (window.HTMLIFrameElement && styleTarget instanceof window.HTMLIFrameElement) {
  11155. try {
  11156. // This will throw an exception if access to iframe is blocked
  11157. // due to cross-origin restrictions
  11158. styleTarget = styleTarget.contentDocument.head;
  11159. } catch(e) {
  11160. styleTarget = null;
  11161. }
  11162. }
  11163. memo[target] = styleTarget;
  11164. }
  11165. return memo[target]
  11166. };
  11167. })();
  11168. var singleton = null;
  11169. var singletonCounter = 0;
  11170. var stylesInsertedAtTop = [];
  11171. var fixUrls = __webpack_require__(/*! ./urls */ "./node_modules/style-loader/lib/urls.js");
  11172. module.exports = function(list, options) {
  11173. if (typeof DEBUG !== "undefined" && DEBUG) {
  11174. if (typeof document !== "object") throw new Error("The style-loader cannot be used in a non-browser environment");
  11175. }
  11176. options = options || {};
  11177. options.attrs = typeof options.attrs === "object" ? options.attrs : {};
  11178. // Force single-tag solution on IE6-9, which has a hard limit on the # of <style>
  11179. // tags it will allow on a page
  11180. if (!options.singleton && typeof options.singleton !== "boolean") options.singleton = isOldIE();
  11181. // By default, add <style> tags to the <head> element
  11182. if (!options.insertInto) options.insertInto = "head";
  11183. // By default, add <style> tags to the bottom of the target
  11184. if (!options.insertAt) options.insertAt = "bottom";
  11185. var styles = listToStyles(list, options);
  11186. addStylesToDom(styles, options);
  11187. return function update (newList) {
  11188. var mayRemove = [];
  11189. for (var i = 0; i < styles.length; i++) {
  11190. var item = styles[i];
  11191. var domStyle = stylesInDom[item.id];
  11192. domStyle.refs--;
  11193. mayRemove.push(domStyle);
  11194. }
  11195. if(newList) {
  11196. var newStyles = listToStyles(newList, options);
  11197. addStylesToDom(newStyles, options);
  11198. }
  11199. for (var i = 0; i < mayRemove.length; i++) {
  11200. var domStyle = mayRemove[i];
  11201. if(domStyle.refs === 0) {
  11202. for (var j = 0; j < domStyle.parts.length; j++) domStyle.parts[j]();
  11203. delete stylesInDom[domStyle.id];
  11204. }
  11205. }
  11206. };
  11207. };
  11208. function addStylesToDom (styles, options) {
  11209. for (var i = 0; i < styles.length; i++) {
  11210. var item = styles[i];
  11211. var domStyle = stylesInDom[item.id];
  11212. if(domStyle) {
  11213. domStyle.refs++;
  11214. for(var j = 0; j < domStyle.parts.length; j++) {
  11215. domStyle.parts[j](item.parts[j]);
  11216. }
  11217. for(; j < item.parts.length; j++) {
  11218. domStyle.parts.push(addStyle(item.parts[j], options));
  11219. }
  11220. } else {
  11221. var parts = [];
  11222. for(var j = 0; j < item.parts.length; j++) {
  11223. parts.push(addStyle(item.parts[j], options));
  11224. }
  11225. stylesInDom[item.id] = {id: item.id, refs: 1, parts: parts};
  11226. }
  11227. }
  11228. }
  11229. function listToStyles (list, options) {
  11230. var styles = [];
  11231. var newStyles = {};
  11232. for (var i = 0; i < list.length; i++) {
  11233. var item = list[i];
  11234. var id = options.base ? item[0] + options.base : item[0];
  11235. var css = item[1];
  11236. var media = item[2];
  11237. var sourceMap = item[3];
  11238. var part = {css: css, media: media, sourceMap: sourceMap};
  11239. if(!newStyles[id]) styles.push(newStyles[id] = {id: id, parts: [part]});
  11240. else newStyles[id].parts.push(part);
  11241. }
  11242. return styles;
  11243. }
  11244. function insertStyleElement (options, style) {
  11245. var target = getElement(options.insertInto)
  11246. if (!target) {
  11247. throw new Error("Couldn't find a style target. This probably means that the value for the 'insertInto' parameter is invalid.");
  11248. }
  11249. var lastStyleElementInsertedAtTop = stylesInsertedAtTop[stylesInsertedAtTop.length - 1];
  11250. if (options.insertAt === "top") {
  11251. if (!lastStyleElementInsertedAtTop) {
  11252. target.insertBefore(style, target.firstChild);
  11253. } else if (lastStyleElementInsertedAtTop.nextSibling) {
  11254. target.insertBefore(style, lastStyleElementInsertedAtTop.nextSibling);
  11255. } else {
  11256. target.appendChild(style);
  11257. }
  11258. stylesInsertedAtTop.push(style);
  11259. } else if (options.insertAt === "bottom") {
  11260. target.appendChild(style);
  11261. } else if (typeof options.insertAt === "object" && options.insertAt.before) {
  11262. var nextSibling = getElement(options.insertAt.before, target);
  11263. target.insertBefore(style, nextSibling);
  11264. } else {
  11265. throw new Error("[Style Loader]\n\n Invalid value for parameter 'insertAt' ('options.insertAt') found.\n Must be 'top', 'bottom', or Object.\n (https://github.com/webpack-contrib/style-loader#insertat)\n");
  11266. }
  11267. }
  11268. function removeStyleElement (style) {
  11269. if (style.parentNode === null) return false;
  11270. style.parentNode.removeChild(style);
  11271. var idx = stylesInsertedAtTop.indexOf(style);
  11272. if(idx >= 0) {
  11273. stylesInsertedAtTop.splice(idx, 1);
  11274. }
  11275. }
  11276. function createStyleElement (options) {
  11277. var style = document.createElement("style");
  11278. if(options.attrs.type === undefined) {
  11279. options.attrs.type = "text/css";
  11280. }
  11281. if(options.attrs.nonce === undefined) {
  11282. var nonce = getNonce();
  11283. if (nonce) {
  11284. options.attrs.nonce = nonce;
  11285. }
  11286. }
  11287. addAttrs(style, options.attrs);
  11288. insertStyleElement(options, style);
  11289. return style;
  11290. }
  11291. function createLinkElement (options) {
  11292. var link = document.createElement("link");
  11293. if(options.attrs.type === undefined) {
  11294. options.attrs.type = "text/css";
  11295. }
  11296. options.attrs.rel = "stylesheet";
  11297. addAttrs(link, options.attrs);
  11298. insertStyleElement(options, link);
  11299. return link;
  11300. }
  11301. function addAttrs (el, attrs) {
  11302. Object.keys(attrs).forEach(function (key) {
  11303. el.setAttribute(key, attrs[key]);
  11304. });
  11305. }
  11306. function getNonce() {
  11307. if (false) {}
  11308. return __webpack_require__.nc;
  11309. }
  11310. function addStyle (obj, options) {
  11311. var style, update, remove, result;
  11312. // If a transform function was defined, run it on the css
  11313. if (options.transform && obj.css) {
  11314. result = typeof options.transform === 'function'
  11315. ? options.transform(obj.css)
  11316. : options.transform.default(obj.css);
  11317. if (result) {
  11318. // If transform returns a value, use that instead of the original css.
  11319. // This allows running runtime transformations on the css.
  11320. obj.css = result;
  11321. } else {
  11322. // If the transform function returns a falsy value, don't add this css.
  11323. // This allows conditional loading of css
  11324. return function() {
  11325. // noop
  11326. };
  11327. }
  11328. }
  11329. if (options.singleton) {
  11330. var styleIndex = singletonCounter++;
  11331. style = singleton || (singleton = createStyleElement(options));
  11332. update = applyToSingletonTag.bind(null, style, styleIndex, false);
  11333. remove = applyToSingletonTag.bind(null, style, styleIndex, true);
  11334. } else if (
  11335. obj.sourceMap &&
  11336. typeof URL === "function" &&
  11337. typeof URL.createObjectURL === "function" &&
  11338. typeof URL.revokeObjectURL === "function" &&
  11339. typeof Blob === "function" &&
  11340. typeof btoa === "function"
  11341. ) {
  11342. style = createLinkElement(options);
  11343. update = updateLink.bind(null, style, options);
  11344. remove = function () {
  11345. removeStyleElement(style);
  11346. if(style.href) URL.revokeObjectURL(style.href);
  11347. };
  11348. } else {
  11349. style = createStyleElement(options);
  11350. update = applyToTag.bind(null, style);
  11351. remove = function () {
  11352. removeStyleElement(style);
  11353. };
  11354. }
  11355. update(obj);
  11356. return function updateStyle (newObj) {
  11357. if (newObj) {
  11358. if (
  11359. newObj.css === obj.css &&
  11360. newObj.media === obj.media &&
  11361. newObj.sourceMap === obj.sourceMap
  11362. ) {
  11363. return;
  11364. }
  11365. update(obj = newObj);
  11366. } else {
  11367. remove();
  11368. }
  11369. };
  11370. }
  11371. var replaceText = (function () {
  11372. var textStore = [];
  11373. return function (index, replacement) {
  11374. textStore[index] = replacement;
  11375. return textStore.filter(Boolean).join('\n');
  11376. };
  11377. })();
  11378. function applyToSingletonTag (style, index, remove, obj) {
  11379. var css = remove ? "" : obj.css;
  11380. if (style.styleSheet) {
  11381. style.styleSheet.cssText = replaceText(index, css);
  11382. } else {
  11383. var cssNode = document.createTextNode(css);
  11384. var childNodes = style.childNodes;
  11385. if (childNodes[index]) style.removeChild(childNodes[index]);
  11386. if (childNodes.length) {
  11387. style.insertBefore(cssNode, childNodes[index]);
  11388. } else {
  11389. style.appendChild(cssNode);
  11390. }
  11391. }
  11392. }
  11393. function applyToTag (style, obj) {
  11394. var css = obj.css;
  11395. var media = obj.media;
  11396. if(media) {
  11397. style.setAttribute("media", media)
  11398. }
  11399. if(style.styleSheet) {
  11400. style.styleSheet.cssText = css;
  11401. } else {
  11402. while(style.firstChild) {
  11403. style.removeChild(style.firstChild);
  11404. }
  11405. style.appendChild(document.createTextNode(css));
  11406. }
  11407. }
  11408. function updateLink (link, options, obj) {
  11409. var css = obj.css;
  11410. var sourceMap = obj.sourceMap;
  11411. /*
  11412. If convertToAbsoluteUrls isn't defined, but sourcemaps are enabled
  11413. and there is no publicPath defined then lets turn convertToAbsoluteUrls
  11414. on by default. Otherwise default to the convertToAbsoluteUrls option
  11415. directly
  11416. */
  11417. var autoFixUrls = options.convertToAbsoluteUrls === undefined && sourceMap;
  11418. if (options.convertToAbsoluteUrls || autoFixUrls) {
  11419. css = fixUrls(css);
  11420. }
  11421. if (sourceMap) {
  11422. // http://stackoverflow.com/a/26603875
  11423. css += "\n/*# sourceMappingURL=data:application/json;base64," + btoa(unescape(encodeURIComponent(JSON.stringify(sourceMap)))) + " */";
  11424. }
  11425. var blob = new Blob([css], { type: "text/css" });
  11426. var oldSrc = link.href;
  11427. link.href = URL.createObjectURL(blob);
  11428. if(oldSrc) URL.revokeObjectURL(oldSrc);
  11429. }
  11430. /***/ }),
  11431. /***/ "./node_modules/style-loader/lib/urls.js":
  11432. /*!***********************************************!*\
  11433. !*** ./node_modules/style-loader/lib/urls.js ***!
  11434. \***********************************************/
  11435. /*! no static exports found */
  11436. /***/ (function(module, exports) {
  11437. /**
  11438. * When source maps are enabled, `style-loader` uses a link element with a data-uri to
  11439. * embed the css on the page. This breaks all relative urls because now they are relative to a
  11440. * bundle instead of the current page.
  11441. *
  11442. * One solution is to only use full urls, but that may be impossible.
  11443. *
  11444. * Instead, this function "fixes" the relative urls to be absolute according to the current page location.
  11445. *
  11446. * A rudimentary test suite is located at `test/fixUrls.js` and can be run via the `npm test` command.
  11447. *
  11448. */
  11449. module.exports = function (css) {
  11450. // get current location
  11451. var location = typeof window !== "undefined" && window.location;
  11452. if (!location) {
  11453. throw new Error("fixUrls requires window.location");
  11454. }
  11455. // blank or null?
  11456. if (!css || typeof css !== "string") {
  11457. return css;
  11458. }
  11459. var baseUrl = location.protocol + "//" + location.host;
  11460. var currentDir = baseUrl + location.pathname.replace(/\/[^\/]*$/, "/");
  11461. // convert each url(...)
  11462. /*
  11463. This regular expression is just a way to recursively match brackets within
  11464. a string.
  11465. /url\s*\( = Match on the word "url" with any whitespace after it and then a parens
  11466. ( = Start a capturing group
  11467. (?: = Start a non-capturing group
  11468. [^)(] = Match anything that isn't a parentheses
  11469. | = OR
  11470. \( = Match a start parentheses
  11471. (?: = Start another non-capturing groups
  11472. [^)(]+ = Match anything that isn't a parentheses
  11473. | = OR
  11474. \( = Match a start parentheses
  11475. [^)(]* = Match anything that isn't a parentheses
  11476. \) = Match a end parentheses
  11477. ) = End Group
  11478. *\) = Match anything and then a close parens
  11479. ) = Close non-capturing group
  11480. * = Match anything
  11481. ) = Close capturing group
  11482. \) = Match a close parens
  11483. /gi = Get all matches, not the first. Be case insensitive.
  11484. */
  11485. var fixedCss = css.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi, function(fullMatch, origUrl) {
  11486. // strip quotes (if they exist)
  11487. var unquotedOrigUrl = origUrl
  11488. .trim()
  11489. .replace(/^"(.*)"$/, function(o, $1){ return $1; })
  11490. .replace(/^'(.*)'$/, function(o, $1){ return $1; });
  11491. // already a full url? no change
  11492. if (/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(unquotedOrigUrl)) {
  11493. return fullMatch;
  11494. }
  11495. // convert the url to a full url
  11496. var newUrl;
  11497. if (unquotedOrigUrl.indexOf("//") === 0) {
  11498. //TODO: should we add protocol?
  11499. newUrl = unquotedOrigUrl;
  11500. } else if (unquotedOrigUrl.indexOf("/") === 0) {
  11501. // path should be relative to the base url
  11502. newUrl = baseUrl + unquotedOrigUrl; // already starts with '/'
  11503. } else {
  11504. // path should be relative to current directory
  11505. newUrl = currentDir + unquotedOrigUrl.replace(/^\.\//, ""); // Strip leading './'
  11506. }
  11507. // send back the fixed url(...)
  11508. return "url(" + JSON.stringify(newUrl) + ")";
  11509. });
  11510. // send back the fixed css
  11511. return fixedCss;
  11512. };
  11513. /***/ }),
  11514. /***/ "./node_modules/tippy.js/esm/index.all.js":
  11515. /*!************************************************!*\
  11516. !*** ./node_modules/tippy.js/esm/index.all.js ***!
  11517. \************************************************/
  11518. /*! exports provided: default */
  11519. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  11520. "use strict";
  11521. __webpack_require__.r(__webpack_exports__);
  11522. /* harmony import */ var popper_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! popper.js */ "./node_modules/popper.js/dist/esm/popper.js");
  11523. /**!
  11524. * tippy.js v4.3.4
  11525. * (c) 2017-2019 atomiks
  11526. * MIT License
  11527. */
  11528. var css = ".tippy-iOS{cursor:pointer!important;-webkit-tap-highlight-color:transparent}.tippy-popper{transition-timing-function:cubic-bezier(.165,.84,.44,1);max-width:calc(100% - 8px);pointer-events:none;outline:0}.tippy-popper[x-placement^=top] .tippy-backdrop{border-radius:40% 40% 0 0}.tippy-popper[x-placement^=top] .tippy-roundarrow{bottom:-7px;bottom:-6.5px;-webkit-transform-origin:50% 0;transform-origin:50% 0;margin:0 3px}.tippy-popper[x-placement^=top] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(180deg);transform:rotate(180deg)}.tippy-popper[x-placement^=top] .tippy-arrow{border-top:8px solid #333;border-right:8px solid transparent;border-left:8px solid transparent;bottom:-7px;margin:0 3px;-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=top] .tippy-backdrop{-webkit-transform-origin:0 25%;transform-origin:0 25%}.tippy-popper[x-placement^=top] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-55%);transform:scale(1) translate(-50%,-55%)}.tippy-popper[x-placement^=top] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-50%,-45%);transform:scale(.2) translate(-50%,-45%);opacity:0}.tippy-popper[x-placement^=top] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateY(-20px);transform:translateY(-20px)}.tippy-popper[x-placement^=top] [data-animation=perspective]{-webkit-transform-origin:bottom;transform-origin:bottom}.tippy-popper[x-placement^=top] [data-animation=perspective][data-state=visible]{-webkit-transform:perspective(700px) translateY(-10px) rotateX(0);transform:perspective(700px) translateY(-10px) rotateX(0)}.tippy-popper[x-placement^=top] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:perspective(700px) translateY(0) rotateX(60deg);transform:perspective(700px) translateY(0) rotateX(60deg)}.tippy-popper[x-placement^=top] [data-animation=fade][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateY(-10px);transform:translateY(-10px)}.tippy-popper[x-placement^=top] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=top] [data-animation=scale]{-webkit-transform-origin:bottom;transform-origin:bottom}.tippy-popper[x-placement^=top] [data-animation=scale][data-state=visible]{-webkit-transform:translateY(-10px) scale(1);transform:translateY(-10px) scale(1)}.tippy-popper[x-placement^=top] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateY(-10px) scale(.5);transform:translateY(-10px) scale(.5)}.tippy-popper[x-placement^=bottom] .tippy-backdrop{border-radius:0 0 30% 30%}.tippy-popper[x-placement^=bottom] .tippy-roundarrow{top:-7px;-webkit-transform-origin:50% 100%;transform-origin:50% 100%;margin:0 3px}.tippy-popper[x-placement^=bottom] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(0);transform:rotate(0)}.tippy-popper[x-placement^=bottom] .tippy-arrow{border-bottom:8px solid #333;border-right:8px solid transparent;border-left:8px solid transparent;top:-7px;margin:0 3px;-webkit-transform-origin:50% 100%;transform-origin:50% 100%}.tippy-popper[x-placement^=bottom] .tippy-backdrop{-webkit-transform-origin:0 -50%;transform-origin:0 -50%}.tippy-popper[x-placement^=bottom] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-45%);transform:scale(1) translate(-50%,-45%)}.tippy-popper[x-placement^=bottom] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-50%);transform:scale(.2) translate(-50%);opacity:0}.tippy-popper[x-placement^=bottom] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateY(20px);transform:translateY(20px)}.tippy-popper[x-placement^=bottom] [data-animation=perspective]{-webkit-transform-origin:top;transform-origin:top}.tippy-popper[x-placement^=bottom] [data-animation=perspective][data-state=visible]{-webkit-transform:perspective(700px) translateY(10px) rotateX(0);transform:perspective(700px) translateY(10px) rotateX(0)}.tippy-popper[x-placement^=bottom] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:perspective(700px) translateY(0) rotateX(-60deg);transform:perspective(700px) translateY(0) rotateX(-60deg)}.tippy-popper[x-placement^=bottom] [data-animation=fade][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateY(10px);transform:translateY(10px)}.tippy-popper[x-placement^=bottom] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateY(0);transform:translateY(0)}.tippy-popper[x-placement^=bottom] [data-animation=scale]{-webkit-transform-origin:top;transform-origin:top}.tippy-popper[x-placement^=bottom] [data-animation=scale][data-state=visible]{-webkit-transform:translateY(10px) scale(1);transform:translateY(10px) scale(1)}.tippy-popper[x-placement^=bottom] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateY(10px) scale(.5);transform:translateY(10px) scale(.5)}.tippy-popper[x-placement^=left] .tippy-backdrop{border-radius:50% 0 0 50%}.tippy-popper[x-placement^=left] .tippy-roundarrow{right:-12px;-webkit-transform-origin:33.33333333% 50%;transform-origin:33.33333333% 50%;margin:3px 0}.tippy-popper[x-placement^=left] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(90deg);transform:rotate(90deg)}.tippy-popper[x-placement^=left] .tippy-arrow{border-left:8px solid #333;border-top:8px solid transparent;border-bottom:8px solid transparent;right:-7px;margin:3px 0;-webkit-transform-origin:0 50%;transform-origin:0 50%}.tippy-popper[x-placement^=left] .tippy-backdrop{-webkit-transform-origin:50% 0;transform-origin:50% 0}.tippy-popper[x-placement^=left] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-50%);transform:scale(1) translate(-50%,-50%)}.tippy-popper[x-placement^=left] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-75%,-50%);transform:scale(.2) translate(-75%,-50%);opacity:0}.tippy-popper[x-placement^=left] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateX(-20px);transform:translateX(-20px)}.tippy-popper[x-placement^=left] [data-animation=perspective]{-webkit-transform-origin:right;transform-origin:right}.tippy-popper[x-placement^=left] [data-animation=perspective][data-state=visible]{-webkit-transform:perspective(700px) translateX(-10px) rotateY(0);transform:perspective(700px) translateX(-10px) rotateY(0)}.tippy-popper[x-placement^=left] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:perspective(700px) translateX(0) rotateY(-60deg);transform:perspective(700px) translateX(0) rotateY(-60deg)}.tippy-popper[x-placement^=left] [data-animation=fade][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateX(-10px);transform:translateX(-10px)}.tippy-popper[x-placement^=left] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateX(0);transform:translateX(0)}.tippy-popper[x-placement^=left] [data-animation=scale]{-webkit-transform-origin:right;transform-origin:right}.tippy-popper[x-placement^=left] [data-animation=scale][data-state=visible]{-webkit-transform:translateX(-10px) scale(1);transform:translateX(-10px) scale(1)}.tippy-popper[x-placement^=left] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateX(-10px) scale(.5);transform:translateX(-10px) scale(.5)}.tippy-popper[x-placement^=right] .tippy-backdrop{border-radius:0 50% 50% 0}.tippy-popper[x-placement^=right] .tippy-roundarrow{left:-12px;-webkit-transform-origin:66.66666666% 50%;transform-origin:66.66666666% 50%;margin:3px 0}.tippy-popper[x-placement^=right] .tippy-roundarrow svg{position:absolute;left:0;-webkit-transform:rotate(-90deg);transform:rotate(-90deg)}.tippy-popper[x-placement^=right] .tippy-arrow{border-right:8px solid #333;border-top:8px solid transparent;border-bottom:8px solid transparent;left:-7px;margin:3px 0;-webkit-transform-origin:100% 50%;transform-origin:100% 50%}.tippy-popper[x-placement^=right] .tippy-backdrop{-webkit-transform-origin:-50% 0;transform-origin:-50% 0}.tippy-popper[x-placement^=right] .tippy-backdrop[data-state=visible]{-webkit-transform:scale(1) translate(-50%,-50%);transform:scale(1) translate(-50%,-50%)}.tippy-popper[x-placement^=right] .tippy-backdrop[data-state=hidden]{-webkit-transform:scale(.2) translate(-25%,-50%);transform:scale(.2) translate(-25%,-50%);opacity:0}.tippy-popper[x-placement^=right] [data-animation=shift-toward][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-toward][data-state=hidden]{opacity:0;-webkit-transform:translateX(20px);transform:translateX(20px)}.tippy-popper[x-placement^=right] [data-animation=perspective]{-webkit-transform-origin:left;transform-origin:left}.tippy-popper[x-placement^=right] [data-animation=perspective][data-state=visible]{-webkit-transform:perspective(700px) translateX(10px) rotateY(0);transform:perspective(700px) translateX(10px) rotateY(0)}.tippy-popper[x-placement^=right] [data-animation=perspective][data-state=hidden]{opacity:0;-webkit-transform:perspective(700px) translateX(0) rotateY(60deg);transform:perspective(700px) translateX(0) rotateY(60deg)}.tippy-popper[x-placement^=right] [data-animation=fade][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=fade][data-state=hidden]{opacity:0;-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-away][data-state=visible]{-webkit-transform:translateX(10px);transform:translateX(10px)}.tippy-popper[x-placement^=right] [data-animation=shift-away][data-state=hidden]{opacity:0;-webkit-transform:translateX(0);transform:translateX(0)}.tippy-popper[x-placement^=right] [data-animation=scale]{-webkit-transform-origin:left;transform-origin:left}.tippy-popper[x-placement^=right] [data-animation=scale][data-state=visible]{-webkit-transform:translateX(10px) scale(1);transform:translateX(10px) scale(1)}.tippy-popper[x-placement^=right] [data-animation=scale][data-state=hidden]{opacity:0;-webkit-transform:translateX(10px) scale(.5);transform:translateX(10px) scale(.5)}.tippy-tooltip{position:relative;color:#fff;border-radius:.25rem;font-size:.875rem;padding:.3125rem .5625rem;line-height:1.4;text-align:center;background-color:#333}.tippy-tooltip[data-size=small]{padding:.1875rem .375rem;font-size:.75rem}.tippy-tooltip[data-size=large]{padding:.375rem .75rem;font-size:1rem}.tippy-tooltip[data-animatefill]{overflow:hidden;background-color:transparent}.tippy-tooltip[data-interactive],.tippy-tooltip[data-interactive] .tippy-roundarrow path{pointer-events:auto}.tippy-tooltip[data-inertia][data-state=visible]{transition-timing-function:cubic-bezier(.54,1.5,.38,1.11)}.tippy-tooltip[data-inertia][data-state=hidden]{transition-timing-function:ease}.tippy-arrow,.tippy-roundarrow{position:absolute;width:0;height:0}.tippy-roundarrow{width:18px;height:7px;fill:#333;pointer-events:none}.tippy-backdrop{position:absolute;background-color:#333;border-radius:50%;width:calc(110% + 2rem);left:50%;top:50%;z-index:-1;transition:all cubic-bezier(.46,.1,.52,.98);-webkit-backface-visibility:hidden;backface-visibility:hidden}.tippy-backdrop:after{content:\"\";float:left;padding-top:100%}.tippy-backdrop+.tippy-content{transition-property:opacity;will-change:opacity}.tippy-backdrop+.tippy-content[data-state=visible]{opacity:1}.tippy-backdrop+.tippy-content[data-state=hidden]{opacity:0}";
  11529. function _extends() {
  11530. _extends = Object.assign || function (target) {
  11531. for (var i = 1; i < arguments.length; i++) {
  11532. var source = arguments[i];
  11533. for (var key in source) {
  11534. if (Object.prototype.hasOwnProperty.call(source, key)) {
  11535. target[key] = source[key];
  11536. }
  11537. }
  11538. }
  11539. return target;
  11540. };
  11541. return _extends.apply(this, arguments);
  11542. }
  11543. var version = "4.3.4";
  11544. var isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
  11545. var ua = isBrowser ? navigator.userAgent : '';
  11546. var isIE = /MSIE |Trident\//.test(ua);
  11547. var isUCBrowser = /UCBrowser\//.test(ua);
  11548. var isIOS = isBrowser && /iPhone|iPad|iPod/.test(navigator.platform) && !window.MSStream;
  11549. var defaultProps = {
  11550. a11y: true,
  11551. allowHTML: true,
  11552. animateFill: true,
  11553. animation: 'shift-away',
  11554. appendTo: function appendTo() {
  11555. return document.body;
  11556. },
  11557. aria: 'describedby',
  11558. arrow: false,
  11559. arrowType: 'sharp',
  11560. boundary: 'scrollParent',
  11561. content: '',
  11562. delay: 0,
  11563. distance: 10,
  11564. duration: [325, 275],
  11565. flip: true,
  11566. flipBehavior: 'flip',
  11567. flipOnUpdate: false,
  11568. followCursor: false,
  11569. hideOnClick: true,
  11570. ignoreAttributes: false,
  11571. inertia: false,
  11572. interactive: false,
  11573. interactiveBorder: 2,
  11574. interactiveDebounce: 0,
  11575. lazy: true,
  11576. maxWidth: 350,
  11577. multiple: false,
  11578. offset: 0,
  11579. onHidden: function onHidden() {},
  11580. onHide: function onHide() {},
  11581. onMount: function onMount() {},
  11582. onShow: function onShow() {},
  11583. onShown: function onShown() {},
  11584. onTrigger: function onTrigger() {},
  11585. placement: 'top',
  11586. popperOptions: {},
  11587. role: 'tooltip',
  11588. showOnInit: false,
  11589. size: 'regular',
  11590. sticky: false,
  11591. target: '',
  11592. theme: 'dark',
  11593. touch: true,
  11594. touchHold: false,
  11595. trigger: 'mouseenter focus',
  11596. triggerTarget: null,
  11597. updateDuration: 0,
  11598. wait: null,
  11599. zIndex: 9999
  11600. /**
  11601. * If the set() method encounters one of these, the popperInstance must be
  11602. * recreated
  11603. */
  11604. };
  11605. var POPPER_INSTANCE_DEPENDENCIES = ['arrow', 'arrowType', 'boundary', 'distance', 'flip', 'flipBehavior', 'flipOnUpdate', 'offset', 'placement', 'popperOptions'];
  11606. var elementProto = isBrowser ? Element.prototype : {};
  11607. var matches = elementProto.matches || elementProto.matchesSelector || elementProto.webkitMatchesSelector || elementProto.mozMatchesSelector || elementProto.msMatchesSelector;
  11608. /**
  11609. * Ponyfill for Array.from - converts iterable values to an array
  11610. */
  11611. function arrayFrom(value) {
  11612. return [].slice.call(value);
  11613. }
  11614. /**
  11615. * Ponyfill for Element.prototype.closest
  11616. */
  11617. function closest(element, selector) {
  11618. return closestCallback(element, function (el) {
  11619. return matches.call(el, selector);
  11620. });
  11621. }
  11622. /**
  11623. * Works like Element.prototype.closest, but uses a callback instead
  11624. */
  11625. function closestCallback(element, callback) {
  11626. while (element) {
  11627. if (callback(element)) {
  11628. return element;
  11629. }
  11630. element = element.parentElement;
  11631. }
  11632. return null;
  11633. }
  11634. // Passive event listener config
  11635. var PASSIVE = {
  11636. passive: true // Popper `preventOverflow` padding
  11637. };
  11638. var PADDING = 4; // Popper attributes
  11639. // In Popper v2 these will be `data-*` instead of `x-*` to adhere to HTML5 spec
  11640. var PLACEMENT_ATTRIBUTE = 'x-placement';
  11641. var OUT_OF_BOUNDARIES_ATTRIBUTE = 'x-out-of-boundaries'; // Classes
  11642. var IOS_CLASS = "tippy-iOS";
  11643. var ACTIVE_CLASS = "tippy-active";
  11644. var POPPER_CLASS = "tippy-popper";
  11645. var TOOLTIP_CLASS = "tippy-tooltip";
  11646. var CONTENT_CLASS = "tippy-content";
  11647. var BACKDROP_CLASS = "tippy-backdrop";
  11648. var ARROW_CLASS = "tippy-arrow";
  11649. var ROUND_ARROW_CLASS = "tippy-roundarrow"; // Selectors
  11650. var POPPER_SELECTOR = ".".concat(POPPER_CLASS);
  11651. var TOOLTIP_SELECTOR = ".".concat(TOOLTIP_CLASS);
  11652. var CONTENT_SELECTOR = ".".concat(CONTENT_CLASS);
  11653. var BACKDROP_SELECTOR = ".".concat(BACKDROP_CLASS);
  11654. var ARROW_SELECTOR = ".".concat(ARROW_CLASS);
  11655. var ROUND_ARROW_SELECTOR = ".".concat(ROUND_ARROW_CLASS);
  11656. var isUsingTouch = false;
  11657. function onDocumentTouch() {
  11658. if (isUsingTouch) {
  11659. return;
  11660. }
  11661. isUsingTouch = true;
  11662. if (isIOS) {
  11663. document.body.classList.add(IOS_CLASS);
  11664. }
  11665. if (window.performance) {
  11666. document.addEventListener('mousemove', onDocumentMouseMove);
  11667. }
  11668. }
  11669. var lastMouseMoveTime = 0;
  11670. function onDocumentMouseMove() {
  11671. var now = performance.now(); // Chrome 60+ is 1 mousemove per animation frame, use 20ms time difference
  11672. if (now - lastMouseMoveTime < 20) {
  11673. isUsingTouch = false;
  11674. document.removeEventListener('mousemove', onDocumentMouseMove);
  11675. if (!isIOS) {
  11676. document.body.classList.remove(IOS_CLASS);
  11677. }
  11678. }
  11679. lastMouseMoveTime = now;
  11680. }
  11681. function onWindowBlur() {
  11682. var _document = document,
  11683. activeElement = _document.activeElement;
  11684. if (activeElement && activeElement.blur && activeElement._tippy) {
  11685. activeElement.blur();
  11686. }
  11687. }
  11688. /**
  11689. * Adds the needed global event listeners
  11690. */
  11691. function bindGlobalEventListeners() {
  11692. document.addEventListener('touchstart', onDocumentTouch, PASSIVE);
  11693. window.addEventListener('blur', onWindowBlur);
  11694. }
  11695. var keys = Object.keys(defaultProps);
  11696. /**
  11697. * Returns an object of optional props from data-tippy-* attributes
  11698. */
  11699. function getDataAttributeOptions(reference) {
  11700. return keys.reduce(function (acc, key) {
  11701. var valueAsString = (reference.getAttribute("data-tippy-".concat(key)) || '').trim();
  11702. if (!valueAsString) {
  11703. return acc;
  11704. }
  11705. if (key === 'content') {
  11706. acc[key] = valueAsString;
  11707. } else {
  11708. try {
  11709. acc[key] = JSON.parse(valueAsString);
  11710. } catch (e) {
  11711. acc[key] = valueAsString;
  11712. }
  11713. }
  11714. return acc;
  11715. }, {});
  11716. }
  11717. /**
  11718. * Polyfills the virtual reference (plain object) with Element.prototype props
  11719. * Mutating because DOM elements are mutated, adds `_tippy` property
  11720. */
  11721. function polyfillElementPrototypeProperties(virtualReference) {
  11722. var polyfills = {
  11723. isVirtual: true,
  11724. attributes: virtualReference.attributes || {},
  11725. contains: function contains() {},
  11726. setAttribute: function setAttribute(key, value) {
  11727. virtualReference.attributes[key] = value;
  11728. },
  11729. getAttribute: function getAttribute(key) {
  11730. return virtualReference.attributes[key];
  11731. },
  11732. removeAttribute: function removeAttribute(key) {
  11733. delete virtualReference.attributes[key];
  11734. },
  11735. hasAttribute: function hasAttribute(key) {
  11736. return key in virtualReference.attributes;
  11737. },
  11738. addEventListener: function addEventListener() {},
  11739. removeEventListener: function removeEventListener() {},
  11740. classList: {
  11741. classNames: {},
  11742. add: function add(key) {
  11743. virtualReference.classList.classNames[key] = true;
  11744. },
  11745. remove: function remove(key) {
  11746. delete virtualReference.classList.classNames[key];
  11747. },
  11748. contains: function contains(key) {
  11749. return key in virtualReference.classList.classNames;
  11750. }
  11751. }
  11752. };
  11753. for (var key in polyfills) {
  11754. virtualReference[key] = polyfills[key];
  11755. }
  11756. }
  11757. /**
  11758. * Determines if a value is a "bare" virtual element (before mutations done
  11759. * by `polyfillElementPrototypeProperties()`). JSDOM elements show up as
  11760. * [object Object], we can check if the value is "element-like" if it has
  11761. * `addEventListener`
  11762. */
  11763. function isBareVirtualElement(value) {
  11764. return {}.toString.call(value) === '[object Object]' && !value.addEventListener;
  11765. }
  11766. /**
  11767. * Determines if the value is a reference element
  11768. */
  11769. function isReferenceElement(value) {
  11770. return !!value._tippy && !matches.call(value, POPPER_SELECTOR);
  11771. }
  11772. /**
  11773. * Safe .hasOwnProperty check, for prototype-less objects
  11774. */
  11775. function hasOwnProperty(obj, key) {
  11776. return {}.hasOwnProperty.call(obj, key);
  11777. }
  11778. /**
  11779. * Returns an array of elements based on the value
  11780. */
  11781. function getArrayOfElements(value) {
  11782. if (isSingular(value)) {
  11783. // TODO: VirtualReference is not compatible to type Element
  11784. return [value];
  11785. }
  11786. if (value instanceof NodeList) {
  11787. return arrayFrom(value);
  11788. }
  11789. if (Array.isArray(value)) {
  11790. return value;
  11791. }
  11792. try {
  11793. return arrayFrom(document.querySelectorAll(value));
  11794. } catch (e) {
  11795. return [];
  11796. }
  11797. }
  11798. /**
  11799. * Returns a value at a given index depending on if it's an array or number
  11800. */
  11801. function getValue(value, index, defaultValue) {
  11802. if (Array.isArray(value)) {
  11803. var v = value[index];
  11804. return v == null ? defaultValue : v;
  11805. }
  11806. return value;
  11807. }
  11808. /**
  11809. * Debounce utility. To avoid bloating bundle size, we're only passing 1
  11810. * argument here, a more generic function would pass all arguments. Only
  11811. * `onMouseMove` uses this which takes the event object for now.
  11812. */
  11813. function debounce(fn, ms) {
  11814. // Avoid wrapping in `setTimeout` if ms is 0 anyway
  11815. if (ms === 0) {
  11816. return fn;
  11817. }
  11818. var timeout;
  11819. return function (arg) {
  11820. clearTimeout(timeout);
  11821. timeout = setTimeout(function () {
  11822. fn(arg);
  11823. }, ms);
  11824. };
  11825. }
  11826. /**
  11827. * Prevents errors from being thrown while accessing nested modifier objects
  11828. * in `popperOptions`
  11829. */
  11830. function getModifier(obj, key) {
  11831. return obj && obj.modifiers && obj.modifiers[key];
  11832. }
  11833. /**
  11834. * Determines if an array or string includes a value
  11835. */
  11836. function includes(a, b) {
  11837. return a.indexOf(b) > -1;
  11838. }
  11839. /**
  11840. * Determines if the value is a real element
  11841. */
  11842. function isRealElement(value) {
  11843. return value instanceof Element;
  11844. }
  11845. /**
  11846. * Determines if the value is singular-like
  11847. */
  11848. function isSingular(value) {
  11849. return !!(value && hasOwnProperty(value, 'isVirtual')) || isRealElement(value);
  11850. }
  11851. /**
  11852. * Firefox extensions don't allow setting .innerHTML directly, this will trick it
  11853. */
  11854. function innerHTML() {
  11855. return 'innerHTML';
  11856. }
  11857. /**
  11858. * Evaluates a function if one, or returns the value
  11859. */
  11860. function invokeWithArgsOrReturn(value, args) {
  11861. return typeof value === 'function' ? value.apply(null, args) : value;
  11862. }
  11863. /**
  11864. * Sets a popperInstance `flip` modifier's enabled state
  11865. */
  11866. function setFlipModifierEnabled(modifiers, value) {
  11867. modifiers.filter(function (m) {
  11868. return m.name === 'flip';
  11869. })[0].enabled = value;
  11870. }
  11871. /**
  11872. * Determines if an element can receive focus
  11873. * Always returns true for virtual objects
  11874. */
  11875. function canReceiveFocus(element) {
  11876. return isRealElement(element) ? matches.call(element, 'a[href],area[href],button,details,input,textarea,select,iframe,[tabindex]') && !element.hasAttribute('disabled') : true;
  11877. }
  11878. /**
  11879. * Returns a new `div` element
  11880. */
  11881. function div() {
  11882. return document.createElement('div');
  11883. }
  11884. /**
  11885. * Applies a transition duration to a list of elements
  11886. */
  11887. function setTransitionDuration(els, value) {
  11888. els.forEach(function (el) {
  11889. if (el) {
  11890. el.style.transitionDuration = "".concat(value, "ms");
  11891. }
  11892. });
  11893. }
  11894. /**
  11895. * Sets the visibility state to elements so they can begin to transition
  11896. */
  11897. function setVisibilityState(els, state) {
  11898. els.forEach(function (el) {
  11899. if (el) {
  11900. el.setAttribute('data-state', state);
  11901. }
  11902. });
  11903. }
  11904. /**
  11905. * Evaluates the props object by merging data attributes and
  11906. * disabling conflicting options where necessary
  11907. */
  11908. function evaluateProps(reference, props) {
  11909. var out = _extends({}, props, {
  11910. content: invokeWithArgsOrReturn(props.content, [reference])
  11911. }, props.ignoreAttributes ? {} : getDataAttributeOptions(reference));
  11912. if (out.arrow || isUCBrowser) {
  11913. out.animateFill = false;
  11914. }
  11915. return out;
  11916. }
  11917. /**
  11918. * Validates an object of options with the valid default props object
  11919. */
  11920. function validateOptions(options, defaultProps) {
  11921. Object.keys(options).forEach(function (option) {
  11922. if (!hasOwnProperty(defaultProps, option)) {
  11923. throw new Error("[tippy]: `".concat(option, "` is not a valid option"));
  11924. }
  11925. });
  11926. }
  11927. /**
  11928. * Sets the innerHTML of an element
  11929. */
  11930. function setInnerHTML(element, html) {
  11931. element[innerHTML()] = isRealElement(html) ? html[innerHTML()] : html;
  11932. }
  11933. /**
  11934. * Sets the content of a tooltip
  11935. */
  11936. function setContent(contentEl, props) {
  11937. if (isRealElement(props.content)) {
  11938. setInnerHTML(contentEl, '');
  11939. contentEl.appendChild(props.content);
  11940. } else if (typeof props.content !== 'function') {
  11941. var key = props.allowHTML ? 'innerHTML' : 'textContent';
  11942. contentEl[key] = props.content;
  11943. }
  11944. }
  11945. /**
  11946. * Returns the child elements of a popper element
  11947. */
  11948. function getChildren(popper) {
  11949. return {
  11950. tooltip: popper.querySelector(TOOLTIP_SELECTOR),
  11951. backdrop: popper.querySelector(BACKDROP_SELECTOR),
  11952. content: popper.querySelector(CONTENT_SELECTOR),
  11953. arrow: popper.querySelector(ARROW_SELECTOR) || popper.querySelector(ROUND_ARROW_SELECTOR)
  11954. };
  11955. }
  11956. /**
  11957. * Adds `data-inertia` attribute
  11958. */
  11959. function addInertia(tooltip) {
  11960. tooltip.setAttribute('data-inertia', '');
  11961. }
  11962. /**
  11963. * Removes `data-inertia` attribute
  11964. */
  11965. function removeInertia(tooltip) {
  11966. tooltip.removeAttribute('data-inertia');
  11967. }
  11968. /**
  11969. * Creates an arrow element and returns it
  11970. */
  11971. function createArrowElement(arrowType) {
  11972. var arrow = div();
  11973. if (arrowType === 'round') {
  11974. arrow.className = ROUND_ARROW_CLASS;
  11975. setInnerHTML(arrow, '<svg viewBox="0 0 18 7" xmlns="http://www.w3.org/2000/svg"><path d="M0 7s2.021-.015 5.253-4.218C6.584 1.051 7.797.007 9 0c1.203-.007 2.416 1.035 3.761 2.782C16.012 7.005 18 7 18 7H0z"/></svg>');
  11976. } else {
  11977. arrow.className = ARROW_CLASS;
  11978. }
  11979. return arrow;
  11980. }
  11981. /**
  11982. * Creates a backdrop element and returns it
  11983. */
  11984. function createBackdropElement() {
  11985. var backdrop = div();
  11986. backdrop.className = BACKDROP_CLASS;
  11987. backdrop.setAttribute('data-state', 'hidden');
  11988. return backdrop;
  11989. }
  11990. /**
  11991. * Adds interactive-related attributes
  11992. */
  11993. function addInteractive(popper, tooltip) {
  11994. popper.setAttribute('tabindex', '-1');
  11995. tooltip.setAttribute('data-interactive', '');
  11996. }
  11997. /**
  11998. * Removes interactive-related attributes
  11999. */
  12000. function removeInteractive(popper, tooltip) {
  12001. popper.removeAttribute('tabindex');
  12002. tooltip.removeAttribute('data-interactive');
  12003. }
  12004. /**
  12005. * Add/remove transitionend listener from tooltip
  12006. */
  12007. function updateTransitionEndListener(tooltip, action, listener) {
  12008. // UC Browser hasn't adopted the `transitionend` event despite supporting
  12009. // unprefixed transitions...
  12010. var eventName = isUCBrowser && document.body.style.webkitTransition !== undefined ? 'webkitTransitionEnd' : 'transitionend';
  12011. tooltip[action + 'EventListener'](eventName, listener);
  12012. }
  12013. /**
  12014. * Returns the popper's placement, ignoring shifting (top-start, etc)
  12015. */
  12016. function getBasicPlacement(popper) {
  12017. var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
  12018. return fullPlacement ? fullPlacement.split('-')[0] : '';
  12019. }
  12020. /**
  12021. * Triggers reflow
  12022. */
  12023. function reflow(popper) {
  12024. void popper.offsetHeight;
  12025. }
  12026. /**
  12027. * Adds/removes theme from tooltip's classList
  12028. */
  12029. function updateTheme(tooltip, action, theme) {
  12030. theme.split(' ').forEach(function (themeName) {
  12031. tooltip.classList[action](themeName + '-theme');
  12032. });
  12033. }
  12034. /**
  12035. * Constructs the popper element and returns it
  12036. */
  12037. function createPopperElement(id, props) {
  12038. var popper = div();
  12039. popper.className = POPPER_CLASS;
  12040. popper.id = "tippy-".concat(id);
  12041. popper.style.zIndex = '' + props.zIndex;
  12042. popper.style.position = 'absolute';
  12043. popper.style.top = '0';
  12044. popper.style.left = '0';
  12045. if (props.role) {
  12046. popper.setAttribute('role', props.role);
  12047. }
  12048. var tooltip = div();
  12049. tooltip.className = TOOLTIP_CLASS;
  12050. tooltip.style.maxWidth = props.maxWidth + (typeof props.maxWidth === 'number' ? 'px' : '');
  12051. tooltip.setAttribute('data-size', props.size);
  12052. tooltip.setAttribute('data-animation', props.animation);
  12053. tooltip.setAttribute('data-state', 'hidden');
  12054. updateTheme(tooltip, 'add', props.theme);
  12055. var content = div();
  12056. content.className = CONTENT_CLASS;
  12057. content.setAttribute('data-state', 'hidden');
  12058. if (props.interactive) {
  12059. addInteractive(popper, tooltip);
  12060. }
  12061. if (props.arrow) {
  12062. tooltip.appendChild(createArrowElement(props.arrowType));
  12063. }
  12064. if (props.animateFill) {
  12065. tooltip.appendChild(createBackdropElement());
  12066. tooltip.setAttribute('data-animatefill', '');
  12067. }
  12068. if (props.inertia) {
  12069. addInertia(tooltip);
  12070. }
  12071. setContent(content, props);
  12072. tooltip.appendChild(content);
  12073. popper.appendChild(tooltip);
  12074. return popper;
  12075. }
  12076. /**
  12077. * Updates the popper element based on the new props
  12078. */
  12079. function updatePopperElement(popper, prevProps, nextProps) {
  12080. var _getChildren = getChildren(popper),
  12081. tooltip = _getChildren.tooltip,
  12082. content = _getChildren.content,
  12083. backdrop = _getChildren.backdrop,
  12084. arrow = _getChildren.arrow;
  12085. popper.style.zIndex = '' + nextProps.zIndex;
  12086. tooltip.setAttribute('data-size', nextProps.size);
  12087. tooltip.setAttribute('data-animation', nextProps.animation);
  12088. tooltip.style.maxWidth = nextProps.maxWidth + (typeof nextProps.maxWidth === 'number' ? 'px' : '');
  12089. if (nextProps.role) {
  12090. popper.setAttribute('role', nextProps.role);
  12091. } else {
  12092. popper.removeAttribute('role');
  12093. }
  12094. if (prevProps.content !== nextProps.content) {
  12095. setContent(content, nextProps);
  12096. } // animateFill
  12097. if (!prevProps.animateFill && nextProps.animateFill) {
  12098. tooltip.appendChild(createBackdropElement());
  12099. tooltip.setAttribute('data-animatefill', '');
  12100. } else if (prevProps.animateFill && !nextProps.animateFill) {
  12101. tooltip.removeChild(backdrop);
  12102. tooltip.removeAttribute('data-animatefill');
  12103. } // arrow
  12104. if (!prevProps.arrow && nextProps.arrow) {
  12105. tooltip.appendChild(createArrowElement(nextProps.arrowType));
  12106. } else if (prevProps.arrow && !nextProps.arrow) {
  12107. tooltip.removeChild(arrow);
  12108. } // arrowType
  12109. if (prevProps.arrow && nextProps.arrow && prevProps.arrowType !== nextProps.arrowType) {
  12110. tooltip.replaceChild(createArrowElement(nextProps.arrowType), arrow);
  12111. } // interactive
  12112. if (!prevProps.interactive && nextProps.interactive) {
  12113. addInteractive(popper, tooltip);
  12114. } else if (prevProps.interactive && !nextProps.interactive) {
  12115. removeInteractive(popper, tooltip);
  12116. } // inertia
  12117. if (!prevProps.inertia && nextProps.inertia) {
  12118. addInertia(tooltip);
  12119. } else if (prevProps.inertia && !nextProps.inertia) {
  12120. removeInertia(tooltip);
  12121. } // theme
  12122. if (prevProps.theme !== nextProps.theme) {
  12123. updateTheme(tooltip, 'remove', prevProps.theme);
  12124. updateTheme(tooltip, 'add', nextProps.theme);
  12125. }
  12126. }
  12127. /**
  12128. * Hides all visible poppers on the document
  12129. */
  12130. function hideAll() {
  12131. var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
  12132. excludedReferenceOrInstance = _ref.exclude,
  12133. duration = _ref.duration;
  12134. arrayFrom(document.querySelectorAll(POPPER_SELECTOR)).forEach(function (popper) {
  12135. var instance = popper._tippy;
  12136. if (instance) {
  12137. var isExcluded = false;
  12138. if (excludedReferenceOrInstance) {
  12139. isExcluded = isReferenceElement(excludedReferenceOrInstance) ? instance.reference === excludedReferenceOrInstance : popper === excludedReferenceOrInstance.popper;
  12140. }
  12141. if (!isExcluded) {
  12142. instance.hide(duration);
  12143. }
  12144. }
  12145. });
  12146. }
  12147. /**
  12148. * Determines if the mouse cursor is outside of the popper's interactive border
  12149. * region
  12150. */
  12151. function isCursorOutsideInteractiveBorder(popperPlacement, popperRect, event, props) {
  12152. if (!popperPlacement) {
  12153. return true;
  12154. }
  12155. var x = event.clientX,
  12156. y = event.clientY;
  12157. var interactiveBorder = props.interactiveBorder,
  12158. distance = props.distance;
  12159. var exceedsTop = popperRect.top - y > (popperPlacement === 'top' ? interactiveBorder + distance : interactiveBorder);
  12160. var exceedsBottom = y - popperRect.bottom > (popperPlacement === 'bottom' ? interactiveBorder + distance : interactiveBorder);
  12161. var exceedsLeft = popperRect.left - x > (popperPlacement === 'left' ? interactiveBorder + distance : interactiveBorder);
  12162. var exceedsRight = x - popperRect.right > (popperPlacement === 'right' ? interactiveBorder + distance : interactiveBorder);
  12163. return exceedsTop || exceedsBottom || exceedsLeft || exceedsRight;
  12164. }
  12165. /**
  12166. * Returns the distance offset, taking into account the default offset due to
  12167. * the transform: translate() rule (10px) in CSS
  12168. */
  12169. function getOffsetDistanceInPx(distance) {
  12170. return -(distance - 10) + 'px';
  12171. }
  12172. var idCounter = 1; // Workaround for IE11's lack of new MouseEvent constructor
  12173. var mouseMoveListeners = [];
  12174. /**
  12175. * Creates and returns a Tippy object. We're using a closure pattern instead of
  12176. * a class so that the exposed object API is clean without private members
  12177. * prefixed with `_`.
  12178. */
  12179. function createTippy(reference, collectionProps) {
  12180. var props = evaluateProps(reference, collectionProps); // If the reference shouldn't have multiple tippys, return null early
  12181. if (!props.multiple && reference._tippy) {
  12182. return null;
  12183. }
  12184. /* ======================= 🔒 Private members 🔒 ======================= */
  12185. var lastTriggerEventType;
  12186. var lastMouseMoveEvent;
  12187. var showTimeoutId;
  12188. var hideTimeoutId;
  12189. var scheduleHideAnimationFrameId;
  12190. var isScheduledToShow = false;
  12191. var isBeingDestroyed = false;
  12192. var previousPlacement;
  12193. var wasVisibleDuringPreviousUpdate = false;
  12194. var hasMountCallbackRun = false;
  12195. var currentMountCallback;
  12196. var currentTransitionEndListener;
  12197. var listeners = [];
  12198. var currentComputedPadding;
  12199. var debouncedOnMouseMove = debounce(onMouseMove, props.interactiveDebounce);
  12200. /* ======================= 🔑 Public members 🔑 ======================= */
  12201. var id = idCounter++;
  12202. var popper = createPopperElement(id, props);
  12203. var popperChildren = getChildren(popper);
  12204. var popperInstance = null;
  12205. var state = {
  12206. // Is the instance currently enabled?
  12207. isEnabled: true,
  12208. // Is the tippy currently showing and not transitioning out?
  12209. isVisible: false,
  12210. // Has the instance been destroyed?
  12211. isDestroyed: false,
  12212. // Is the tippy currently mounted to the DOM?
  12213. isMounted: false,
  12214. // Has the tippy finished transitioning in?
  12215. isShown: false
  12216. };
  12217. var instance = {
  12218. // properties
  12219. id: id,
  12220. reference: reference,
  12221. popper: popper,
  12222. popperChildren: popperChildren,
  12223. popperInstance: popperInstance,
  12224. props: props,
  12225. state: state,
  12226. // methods
  12227. clearDelayTimeouts: clearDelayTimeouts,
  12228. set: set,
  12229. setContent: setContent,
  12230. show: show,
  12231. hide: hide,
  12232. enable: enable,
  12233. disable: disable,
  12234. destroy: destroy
  12235. /* ==================== Initial instance mutations =================== */
  12236. };
  12237. reference._tippy = instance;
  12238. popper._tippy = instance;
  12239. addTriggersToReference();
  12240. if (!props.lazy) {
  12241. createPopperInstance();
  12242. }
  12243. if (props.showOnInit) {
  12244. scheduleShow();
  12245. } // Ensure the event listeners target can receive focus
  12246. if (props.a11y && !props.target && !canReceiveFocus(getEventListenersTarget())) {
  12247. getEventListenersTarget().setAttribute('tabindex', '0');
  12248. } // Prevent a tippy with a delay from hiding if the cursor left then returned
  12249. // before it started hiding
  12250. popper.addEventListener('mouseenter', function (event) {
  12251. if (instance.props.interactive && instance.state.isVisible && lastTriggerEventType === 'mouseenter') {
  12252. // We don't want props.onTrigger() to be called here, since the `event`
  12253. // object is not related to the reference element
  12254. scheduleShow(event, true);
  12255. }
  12256. });
  12257. popper.addEventListener('mouseleave', function () {
  12258. if (instance.props.interactive && lastTriggerEventType === 'mouseenter') {
  12259. document.addEventListener('mousemove', debouncedOnMouseMove);
  12260. }
  12261. });
  12262. return instance;
  12263. /* ======================= 🔒 Private methods 🔒 ======================= */
  12264. /**
  12265. * Removes the follow cursor listener
  12266. */
  12267. function removeFollowCursorListener() {
  12268. document.removeEventListener('mousemove', positionVirtualReferenceNearCursor);
  12269. }
  12270. /**
  12271. * Cleans up interactive mouse listeners
  12272. */
  12273. function cleanupInteractiveMouseListeners() {
  12274. document.body.removeEventListener('mouseleave', scheduleHide);
  12275. document.removeEventListener('mousemove', debouncedOnMouseMove);
  12276. mouseMoveListeners = mouseMoveListeners.filter(function (listener) {
  12277. return listener !== debouncedOnMouseMove;
  12278. });
  12279. }
  12280. /**
  12281. * Returns correct target used for event listeners
  12282. */
  12283. function getEventListenersTarget() {
  12284. return instance.props.triggerTarget || reference;
  12285. }
  12286. /**
  12287. * Adds the document click event listener for the instance
  12288. */
  12289. function addDocumentClickListener() {
  12290. document.addEventListener('click', onDocumentClick, true);
  12291. }
  12292. /**
  12293. * Removes the document click event listener for the instance
  12294. */
  12295. function removeDocumentClickListener() {
  12296. document.removeEventListener('click', onDocumentClick, true);
  12297. }
  12298. /**
  12299. * Returns transitionable inner elements used in show/hide methods
  12300. */
  12301. function getTransitionableElements() {
  12302. return [instance.popperChildren.tooltip, instance.popperChildren.backdrop, instance.popperChildren.content];
  12303. }
  12304. /**
  12305. * Determines if the instance is in `followCursor` mode.
  12306. * NOTE: in v5, touch devices will use `initial` behavior no matter the value.
  12307. */
  12308. function getIsInLooseFollowCursorMode() {
  12309. var followCursor = instance.props.followCursor;
  12310. return followCursor && lastTriggerEventType !== 'focus' || isUsingTouch && followCursor === 'initial';
  12311. }
  12312. /**
  12313. * Updates the tooltip's position on each animation frame
  12314. */
  12315. function makeSticky() {
  12316. setTransitionDuration([popper], isIE ? 0 : instance.props.updateDuration);
  12317. function updatePosition() {
  12318. instance.popperInstance.scheduleUpdate();
  12319. if (instance.state.isMounted) {
  12320. requestAnimationFrame(updatePosition);
  12321. } else {
  12322. setTransitionDuration([popper], 0);
  12323. }
  12324. }
  12325. updatePosition();
  12326. }
  12327. /**
  12328. * Invokes a callback once the tooltip has fully transitioned out
  12329. */
  12330. function onTransitionedOut(duration, callback) {
  12331. onTransitionEnd(duration, function () {
  12332. if (!instance.state.isVisible && popper.parentNode && popper.parentNode.contains(popper)) {
  12333. callback();
  12334. }
  12335. });
  12336. }
  12337. /**
  12338. * Invokes a callback once the tooltip has fully transitioned in
  12339. */
  12340. function onTransitionedIn(duration, callback) {
  12341. onTransitionEnd(duration, callback);
  12342. }
  12343. /**
  12344. * Invokes a callback once the tooltip's CSS transition ends
  12345. */
  12346. function onTransitionEnd(duration, callback) {
  12347. var tooltip = instance.popperChildren.tooltip;
  12348. /**
  12349. * Listener added as the `transitionend` handler
  12350. */
  12351. function listener(event) {
  12352. if (event.target === tooltip) {
  12353. updateTransitionEndListener(tooltip, 'remove', listener);
  12354. callback();
  12355. }
  12356. } // Make callback synchronous if duration is 0
  12357. // `transitionend` won't fire otherwise
  12358. if (duration === 0) {
  12359. return callback();
  12360. }
  12361. updateTransitionEndListener(tooltip, 'remove', currentTransitionEndListener);
  12362. updateTransitionEndListener(tooltip, 'add', listener);
  12363. currentTransitionEndListener = listener;
  12364. }
  12365. /**
  12366. * Adds an event listener to the reference and stores it in `listeners`
  12367. */
  12368. function on(eventType, handler) {
  12369. var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  12370. getEventListenersTarget().addEventListener(eventType, handler, options);
  12371. listeners.push({
  12372. eventType: eventType,
  12373. handler: handler,
  12374. options: options
  12375. });
  12376. }
  12377. /**
  12378. * Adds event listeners to the reference based on the `trigger` prop
  12379. */
  12380. function addTriggersToReference() {
  12381. if (instance.props.touchHold && !instance.props.target) {
  12382. on('touchstart', onTrigger, PASSIVE);
  12383. on('touchend', onMouseLeave, PASSIVE);
  12384. }
  12385. instance.props.trigger.trim().split(' ').forEach(function (eventType) {
  12386. if (eventType === 'manual') {
  12387. return;
  12388. } // Non-delegates
  12389. if (!instance.props.target) {
  12390. on(eventType, onTrigger);
  12391. switch (eventType) {
  12392. case 'mouseenter':
  12393. on('mouseleave', onMouseLeave);
  12394. break;
  12395. case 'focus':
  12396. on(isIE ? 'focusout' : 'blur', onBlur);
  12397. break;
  12398. }
  12399. } else {
  12400. // Delegates
  12401. switch (eventType) {
  12402. case 'mouseenter':
  12403. on('mouseover', onDelegateShow);
  12404. on('mouseout', onDelegateHide);
  12405. break;
  12406. case 'focus':
  12407. on('focusin', onDelegateShow);
  12408. on('focusout', onDelegateHide);
  12409. break;
  12410. case 'click':
  12411. on(eventType, onDelegateShow);
  12412. break;
  12413. }
  12414. }
  12415. });
  12416. }
  12417. /**
  12418. * Removes event listeners from the reference
  12419. */
  12420. function removeTriggersFromReference() {
  12421. listeners.forEach(function (_ref) {
  12422. var eventType = _ref.eventType,
  12423. handler = _ref.handler,
  12424. options = _ref.options;
  12425. getEventListenersTarget().removeEventListener(eventType, handler, options);
  12426. });
  12427. listeners = [];
  12428. }
  12429. /**
  12430. * Positions the virtual reference near the cursor
  12431. */
  12432. function positionVirtualReferenceNearCursor(event) {
  12433. var _lastMouseMoveEvent = lastMouseMoveEvent = event,
  12434. x = _lastMouseMoveEvent.clientX,
  12435. y = _lastMouseMoveEvent.clientY; // Gets set once popperInstance `onCreate` has been called
  12436. if (!currentComputedPadding) {
  12437. return;
  12438. } // If the instance is interactive, avoid updating the position unless it's
  12439. // over the reference element
  12440. var isCursorOverReference = closestCallback(event.target, function (el) {
  12441. return el === reference;
  12442. });
  12443. var rect = reference.getBoundingClientRect();
  12444. var followCursor = instance.props.followCursor;
  12445. var isHorizontal = followCursor === 'horizontal';
  12446. var isVertical = followCursor === 'vertical'; // The virtual reference needs some size to prevent itself from overflowing
  12447. var isVerticalPlacement = includes(['top', 'bottom'], getBasicPlacement(popper));
  12448. var fullPlacement = popper.getAttribute(PLACEMENT_ATTRIBUTE);
  12449. var isVariation = fullPlacement ? !!fullPlacement.split('-')[1] : false;
  12450. var size = isVerticalPlacement ? popper.offsetWidth : popper.offsetHeight;
  12451. var halfSize = size / 2;
  12452. var verticalIncrease = isVerticalPlacement ? 0 : isVariation ? size : halfSize;
  12453. var horizontalIncrease = isVerticalPlacement ? isVariation ? size : halfSize : 0;
  12454. if (isCursorOverReference || !instance.props.interactive) {
  12455. instance.popperInstance.reference = _extends({}, instance.popperInstance.reference, {
  12456. // These `client` values don't get used by Popper.js if they are 0
  12457. clientWidth: 0,
  12458. clientHeight: 0,
  12459. getBoundingClientRect: function getBoundingClientRect() {
  12460. return {
  12461. width: isVerticalPlacement ? size : 0,
  12462. height: isVerticalPlacement ? 0 : size,
  12463. top: (isHorizontal ? rect.top : y) - verticalIncrease,
  12464. bottom: (isHorizontal ? rect.bottom : y) + verticalIncrease,
  12465. left: (isVertical ? rect.left : x) - horizontalIncrease,
  12466. right: (isVertical ? rect.right : x) + horizontalIncrease
  12467. };
  12468. }
  12469. });
  12470. instance.popperInstance.update();
  12471. }
  12472. if (followCursor === 'initial' && instance.state.isVisible) {
  12473. removeFollowCursorListener();
  12474. }
  12475. }
  12476. /**
  12477. * Creates the tippy instance for a delegate when it's been triggered
  12478. */
  12479. function createDelegateChildTippy(event) {
  12480. if (event) {
  12481. var targetEl = closest(event.target, instance.props.target);
  12482. if (targetEl && !targetEl._tippy) {
  12483. createTippy(targetEl, _extends({}, instance.props, {
  12484. content: invokeWithArgsOrReturn(collectionProps.content, [targetEl]),
  12485. appendTo: collectionProps.appendTo,
  12486. target: '',
  12487. showOnInit: true
  12488. }));
  12489. }
  12490. }
  12491. }
  12492. /**
  12493. * Event listener invoked upon trigger
  12494. */
  12495. function onTrigger(event) {
  12496. if (!instance.state.isEnabled || isEventListenerStopped(event)) {
  12497. return;
  12498. }
  12499. if (!instance.state.isVisible) {
  12500. lastTriggerEventType = event.type;
  12501. if (event instanceof MouseEvent) {
  12502. lastMouseMoveEvent = event; // If scrolling, `mouseenter` events can be fired if the cursor lands
  12503. // over a new target, but `mousemove` events don't get fired. This
  12504. // causes interactive tooltips to get stuck open until the cursor is
  12505. // moved
  12506. mouseMoveListeners.forEach(function (listener) {
  12507. return listener(event);
  12508. });
  12509. }
  12510. } // Toggle show/hide when clicking click-triggered tooltips
  12511. if (event.type === 'click' && instance.props.hideOnClick !== false && instance.state.isVisible) {
  12512. scheduleHide();
  12513. } else {
  12514. scheduleShow(event);
  12515. }
  12516. }
  12517. /**
  12518. * Event listener used for interactive tooltips to detect when they should
  12519. * hide
  12520. */
  12521. function onMouseMove(event) {
  12522. var isCursorOverPopper = closest(event.target, POPPER_SELECTOR) === popper;
  12523. var isCursorOverReference = closestCallback(event.target, function (el) {
  12524. return el === reference;
  12525. });
  12526. if (isCursorOverPopper || isCursorOverReference) {
  12527. return;
  12528. }
  12529. if (isCursorOutsideInteractiveBorder(getBasicPlacement(popper), popper.getBoundingClientRect(), event, instance.props)) {
  12530. cleanupInteractiveMouseListeners();
  12531. scheduleHide();
  12532. }
  12533. }
  12534. /**
  12535. * Event listener invoked upon mouseleave
  12536. */
  12537. function onMouseLeave(event) {
  12538. if (isEventListenerStopped(event)) {
  12539. return;
  12540. }
  12541. if (instance.props.interactive) {
  12542. document.body.addEventListener('mouseleave', scheduleHide);
  12543. document.addEventListener('mousemove', debouncedOnMouseMove);
  12544. mouseMoveListeners.push(debouncedOnMouseMove);
  12545. return;
  12546. }
  12547. scheduleHide();
  12548. }
  12549. /**
  12550. * Event listener invoked upon blur
  12551. */
  12552. function onBlur(event) {
  12553. if (event.target !== getEventListenersTarget()) {
  12554. return;
  12555. }
  12556. if (instance.props.interactive && event.relatedTarget && popper.contains(event.relatedTarget)) {
  12557. return;
  12558. }
  12559. scheduleHide();
  12560. }
  12561. /**
  12562. * Event listener invoked when a child target is triggered
  12563. */
  12564. function onDelegateShow(event) {
  12565. if (closest(event.target, instance.props.target)) {
  12566. scheduleShow(event);
  12567. }
  12568. }
  12569. /**
  12570. * Event listener invoked when a child target should hide
  12571. */
  12572. function onDelegateHide(event) {
  12573. if (closest(event.target, instance.props.target)) {
  12574. scheduleHide();
  12575. }
  12576. }
  12577. /**
  12578. * Determines if an event listener should stop further execution due to the
  12579. * `touchHold` option
  12580. */
  12581. function isEventListenerStopped(event) {
  12582. var supportsTouch = 'ontouchstart' in window;
  12583. var isTouchEvent = includes(event.type, 'touch');
  12584. var touchHold = instance.props.touchHold;
  12585. return supportsTouch && isUsingTouch && touchHold && !isTouchEvent || isUsingTouch && !touchHold && isTouchEvent;
  12586. }
  12587. /**
  12588. * Runs the mount callback
  12589. */
  12590. function runMountCallback() {
  12591. if (!hasMountCallbackRun && currentMountCallback) {
  12592. hasMountCallbackRun = true;
  12593. reflow(popper);
  12594. currentMountCallback();
  12595. }
  12596. }
  12597. /**
  12598. * Creates the popper instance for the instance
  12599. */
  12600. function createPopperInstance() {
  12601. var popperOptions = instance.props.popperOptions;
  12602. var _instance$popperChild = instance.popperChildren,
  12603. tooltip = _instance$popperChild.tooltip,
  12604. arrow = _instance$popperChild.arrow;
  12605. var preventOverflowModifier = getModifier(popperOptions, 'preventOverflow');
  12606. function applyMutations(data) {
  12607. if (instance.props.flip && !instance.props.flipOnUpdate) {
  12608. if (data.flipped) {
  12609. instance.popperInstance.options.placement = data.placement;
  12610. }
  12611. setFlipModifierEnabled(instance.popperInstance.modifiers, false);
  12612. } // Apply all of the popper's attributes to the tootip node as well.
  12613. // Allows users to avoid using the .tippy-popper selector for themes.
  12614. tooltip.setAttribute(PLACEMENT_ATTRIBUTE, data.placement);
  12615. if (data.attributes[OUT_OF_BOUNDARIES_ATTRIBUTE] !== false) {
  12616. tooltip.setAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE, '');
  12617. } else {
  12618. tooltip.removeAttribute(OUT_OF_BOUNDARIES_ATTRIBUTE);
  12619. } // Prevents a transition when changing placements (while tippy is visible)
  12620. // for scroll/resize updates
  12621. if (previousPlacement && previousPlacement !== data.placement && wasVisibleDuringPreviousUpdate) {
  12622. tooltip.style.transition = 'none';
  12623. requestAnimationFrame(function () {
  12624. tooltip.style.transition = '';
  12625. });
  12626. }
  12627. previousPlacement = data.placement;
  12628. wasVisibleDuringPreviousUpdate = instance.state.isVisible;
  12629. var basicPlacement = getBasicPlacement(popper);
  12630. var styles = tooltip.style; // Account for the `distance` offset
  12631. styles.top = styles.bottom = styles.left = styles.right = '';
  12632. styles[basicPlacement] = getOffsetDistanceInPx(instance.props.distance);
  12633. var padding = preventOverflowModifier && preventOverflowModifier.padding !== undefined ? preventOverflowModifier.padding : PADDING;
  12634. var isPaddingNumber = typeof padding === 'number';
  12635. var computedPadding = _extends({
  12636. top: isPaddingNumber ? padding : padding.top,
  12637. bottom: isPaddingNumber ? padding : padding.bottom,
  12638. left: isPaddingNumber ? padding : padding.left,
  12639. right: isPaddingNumber ? padding : padding.right
  12640. }, !isPaddingNumber && padding);
  12641. computedPadding[basicPlacement] = isPaddingNumber ? padding + instance.props.distance : (padding[basicPlacement] || 0) + instance.props.distance;
  12642. instance.popperInstance.modifiers.filter(function (m) {
  12643. return m.name === 'preventOverflow';
  12644. })[0].padding = computedPadding;
  12645. currentComputedPadding = computedPadding;
  12646. }
  12647. var config = _extends({
  12648. eventsEnabled: false,
  12649. placement: instance.props.placement
  12650. }, popperOptions, {
  12651. modifiers: _extends({}, popperOptions ? popperOptions.modifiers : {}, {
  12652. preventOverflow: _extends({
  12653. boundariesElement: instance.props.boundary,
  12654. padding: PADDING
  12655. }, preventOverflowModifier),
  12656. arrow: _extends({
  12657. element: arrow,
  12658. enabled: !!arrow
  12659. }, getModifier(popperOptions, 'arrow')),
  12660. flip: _extends({
  12661. enabled: instance.props.flip,
  12662. // The tooltip is offset by 10px from the popper in CSS,
  12663. // we need to account for its distance
  12664. padding: instance.props.distance + PADDING,
  12665. behavior: instance.props.flipBehavior
  12666. }, getModifier(popperOptions, 'flip')),
  12667. offset: _extends({
  12668. offset: instance.props.offset
  12669. }, getModifier(popperOptions, 'offset'))
  12670. }),
  12671. onCreate: function onCreate(data) {
  12672. applyMutations(data);
  12673. runMountCallback();
  12674. if (popperOptions && popperOptions.onCreate) {
  12675. popperOptions.onCreate(data);
  12676. }
  12677. },
  12678. onUpdate: function onUpdate(data) {
  12679. applyMutations(data);
  12680. runMountCallback();
  12681. if (popperOptions && popperOptions.onUpdate) {
  12682. popperOptions.onUpdate(data);
  12683. }
  12684. }
  12685. });
  12686. instance.popperInstance = new popper_js__WEBPACK_IMPORTED_MODULE_0__["default"](reference, popper, config);
  12687. }
  12688. /**
  12689. * Mounts the tooltip to the DOM
  12690. */
  12691. function mount() {
  12692. hasMountCallbackRun = false;
  12693. var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
  12694. if (instance.popperInstance) {
  12695. setFlipModifierEnabled(instance.popperInstance.modifiers, instance.props.flip);
  12696. if (!isInLooseFollowCursorMode) {
  12697. instance.popperInstance.reference = reference;
  12698. instance.popperInstance.enableEventListeners();
  12699. }
  12700. instance.popperInstance.scheduleUpdate();
  12701. } else {
  12702. createPopperInstance();
  12703. if (!isInLooseFollowCursorMode) {
  12704. instance.popperInstance.enableEventListeners();
  12705. }
  12706. }
  12707. var appendTo = instance.props.appendTo;
  12708. var parentNode = appendTo === 'parent' ? reference.parentNode : invokeWithArgsOrReturn(appendTo, [reference]);
  12709. if (!parentNode.contains(popper)) {
  12710. parentNode.appendChild(popper);
  12711. instance.props.onMount(instance);
  12712. instance.state.isMounted = true;
  12713. }
  12714. }
  12715. /**
  12716. * Setup before show() is invoked (delays, etc.)
  12717. */
  12718. function scheduleShow(event, shouldAvoidCallingOnTrigger) {
  12719. clearDelayTimeouts();
  12720. if (instance.state.isVisible) {
  12721. return;
  12722. } // Is a delegate, create an instance for the child target
  12723. if (instance.props.target) {
  12724. return createDelegateChildTippy(event);
  12725. }
  12726. isScheduledToShow = true;
  12727. if (event && !shouldAvoidCallingOnTrigger) {
  12728. instance.props.onTrigger(instance, event);
  12729. }
  12730. if (instance.props.wait) {
  12731. return instance.props.wait(instance, event);
  12732. } // If the tooltip has a delay, we need to be listening to the mousemove as
  12733. // soon as the trigger event is fired, so that it's in the correct position
  12734. // upon mount.
  12735. // Edge case: if the tooltip is still mounted, but then scheduleShow() is
  12736. // called, it causes a jump.
  12737. if (getIsInLooseFollowCursorMode() && !instance.state.isMounted) {
  12738. if (!instance.popperInstance) {
  12739. createPopperInstance();
  12740. }
  12741. document.addEventListener('mousemove', positionVirtualReferenceNearCursor);
  12742. }
  12743. addDocumentClickListener();
  12744. var delay = getValue(instance.props.delay, 0, defaultProps.delay);
  12745. if (delay) {
  12746. showTimeoutId = setTimeout(function () {
  12747. show();
  12748. }, delay);
  12749. } else {
  12750. show();
  12751. }
  12752. }
  12753. /**
  12754. * Setup before hide() is invoked (delays, etc.)
  12755. */
  12756. function scheduleHide() {
  12757. clearDelayTimeouts();
  12758. if (!instance.state.isVisible) {
  12759. return removeFollowCursorListener();
  12760. }
  12761. isScheduledToShow = false;
  12762. var delay = getValue(instance.props.delay, 1, defaultProps.delay);
  12763. if (delay) {
  12764. hideTimeoutId = setTimeout(function () {
  12765. if (instance.state.isVisible) {
  12766. hide();
  12767. }
  12768. }, delay);
  12769. } else {
  12770. // Fixes a `transitionend` problem when it fires 1 frame too
  12771. // late sometimes, we don't want hide() to be called.
  12772. scheduleHideAnimationFrameId = requestAnimationFrame(function () {
  12773. hide();
  12774. });
  12775. }
  12776. }
  12777. /**
  12778. * Listener to handle clicks on the document to determine if the
  12779. * instance should hide
  12780. */
  12781. function onDocumentClick(event) {
  12782. // Clicked on interactive popper
  12783. if (instance.props.interactive && popper.contains(event.target)) {
  12784. return;
  12785. } // Clicked on the event listeners target
  12786. if (getEventListenersTarget().contains(event.target)) {
  12787. if (isUsingTouch) {
  12788. return;
  12789. }
  12790. if (instance.state.isVisible && includes(instance.props.trigger, 'click')) {
  12791. return;
  12792. }
  12793. }
  12794. if (instance.props.hideOnClick === true) {
  12795. clearDelayTimeouts();
  12796. hide();
  12797. }
  12798. }
  12799. /* ======================= 🔑 Public methods 🔑 ======================= */
  12800. /**
  12801. * Enables the instance to allow it to show or hide
  12802. */
  12803. function enable() {
  12804. instance.state.isEnabled = true;
  12805. }
  12806. /**
  12807. * Disables the instance to disallow it to show or hide
  12808. */
  12809. function disable() {
  12810. instance.state.isEnabled = false;
  12811. }
  12812. /**
  12813. * Clears pending timeouts related to the `delay` prop if any
  12814. */
  12815. function clearDelayTimeouts() {
  12816. clearTimeout(showTimeoutId);
  12817. clearTimeout(hideTimeoutId);
  12818. cancelAnimationFrame(scheduleHideAnimationFrameId);
  12819. }
  12820. /**
  12821. * Sets new props for the instance and redraws the tooltip
  12822. */
  12823. function set(options) {
  12824. // Backwards-compatible after TypeScript change
  12825. options = options || {};
  12826. validateOptions(options, defaultProps);
  12827. removeTriggersFromReference();
  12828. var prevProps = instance.props;
  12829. var nextProps = evaluateProps(reference, _extends({}, instance.props, options, {
  12830. ignoreAttributes: true
  12831. }));
  12832. nextProps.ignoreAttributes = hasOwnProperty(options, 'ignoreAttributes') ? options.ignoreAttributes || false : prevProps.ignoreAttributes;
  12833. instance.props = nextProps;
  12834. addTriggersToReference();
  12835. cleanupInteractiveMouseListeners();
  12836. debouncedOnMouseMove = debounce(onMouseMove, nextProps.interactiveDebounce);
  12837. updatePopperElement(popper, prevProps, nextProps);
  12838. instance.popperChildren = getChildren(popper);
  12839. if (instance.popperInstance) {
  12840. if (POPPER_INSTANCE_DEPENDENCIES.some(function (prop) {
  12841. return hasOwnProperty(options, prop) && options[prop] !== prevProps[prop];
  12842. })) {
  12843. instance.popperInstance.destroy();
  12844. createPopperInstance();
  12845. if (instance.state.isVisible) {
  12846. instance.popperInstance.enableEventListeners();
  12847. }
  12848. if (instance.props.followCursor && lastMouseMoveEvent) {
  12849. positionVirtualReferenceNearCursor(lastMouseMoveEvent);
  12850. }
  12851. } else {
  12852. instance.popperInstance.update();
  12853. }
  12854. }
  12855. }
  12856. /**
  12857. * Shortcut for .set({ content: newContent })
  12858. */
  12859. function setContent(content) {
  12860. set({
  12861. content: content
  12862. });
  12863. }
  12864. /**
  12865. * Shows the tooltip
  12866. */
  12867. function show() {
  12868. var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 0, defaultProps.duration[1]);
  12869. if (instance.state.isDestroyed || !instance.state.isEnabled || isUsingTouch && !instance.props.touch) {
  12870. return;
  12871. } // Standardize `disabled` behavior across browsers.
  12872. // Firefox allows events on disabled elements, but Chrome doesn't.
  12873. // Using a wrapper element (i.e. <span>) is recommended.
  12874. if (getEventListenersTarget().hasAttribute('disabled')) {
  12875. return;
  12876. }
  12877. if (instance.props.onShow(instance) === false) {
  12878. return;
  12879. }
  12880. addDocumentClickListener();
  12881. popper.style.visibility = 'visible';
  12882. instance.state.isVisible = true;
  12883. if (instance.props.interactive) {
  12884. getEventListenersTarget().classList.add(ACTIVE_CLASS);
  12885. } // Prevent a transition if the popper is at the opposite placement
  12886. var transitionableElements = getTransitionableElements();
  12887. setTransitionDuration(transitionableElements.concat(popper), 0);
  12888. currentMountCallback = function currentMountCallback() {
  12889. if (!instance.state.isVisible) {
  12890. return;
  12891. }
  12892. var isInLooseFollowCursorMode = getIsInLooseFollowCursorMode();
  12893. if (isInLooseFollowCursorMode && lastMouseMoveEvent) {
  12894. positionVirtualReferenceNearCursor(lastMouseMoveEvent);
  12895. } else if (!isInLooseFollowCursorMode) {
  12896. // Double update will apply correct mutations
  12897. instance.popperInstance.update();
  12898. }
  12899. if (instance.popperChildren.backdrop) {
  12900. instance.popperChildren.content.style.transitionDelay = Math.round(duration / 12) + 'ms';
  12901. }
  12902. if (instance.props.sticky) {
  12903. makeSticky();
  12904. }
  12905. setTransitionDuration([popper], instance.props.updateDuration);
  12906. setTransitionDuration(transitionableElements, duration);
  12907. setVisibilityState(transitionableElements, 'visible');
  12908. onTransitionedIn(duration, function () {
  12909. if (instance.props.aria) {
  12910. getEventListenersTarget().setAttribute("aria-".concat(instance.props.aria), popper.id);
  12911. }
  12912. instance.props.onShown(instance);
  12913. instance.state.isShown = true;
  12914. });
  12915. };
  12916. mount();
  12917. }
  12918. /**
  12919. * Hides the tooltip
  12920. */
  12921. function hide() {
  12922. var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getValue(instance.props.duration, 1, defaultProps.duration[1]);
  12923. if (instance.state.isDestroyed || !instance.state.isEnabled && !isBeingDestroyed) {
  12924. return;
  12925. }
  12926. if (instance.props.onHide(instance) === false && !isBeingDestroyed) {
  12927. return;
  12928. }
  12929. removeDocumentClickListener();
  12930. popper.style.visibility = 'hidden';
  12931. instance.state.isVisible = false;
  12932. instance.state.isShown = false;
  12933. wasVisibleDuringPreviousUpdate = false;
  12934. if (instance.props.interactive) {
  12935. getEventListenersTarget().classList.remove(ACTIVE_CLASS);
  12936. }
  12937. var transitionableElements = getTransitionableElements();
  12938. setTransitionDuration(transitionableElements, duration);
  12939. setVisibilityState(transitionableElements, 'hidden');
  12940. onTransitionedOut(duration, function () {
  12941. if (!isScheduledToShow) {
  12942. removeFollowCursorListener();
  12943. }
  12944. if (instance.props.aria) {
  12945. getEventListenersTarget().removeAttribute("aria-".concat(instance.props.aria));
  12946. }
  12947. instance.popperInstance.disableEventListeners();
  12948. instance.popperInstance.options.placement = instance.props.placement;
  12949. popper.parentNode.removeChild(popper);
  12950. instance.props.onHidden(instance);
  12951. instance.state.isMounted = false;
  12952. });
  12953. }
  12954. /**
  12955. * Destroys the tooltip
  12956. */
  12957. function destroy(destroyTargetInstances) {
  12958. if (instance.state.isDestroyed) {
  12959. return;
  12960. }
  12961. isBeingDestroyed = true; // If the popper is currently mounted to the DOM, we want to ensure it gets
  12962. // hidden and unmounted instantly upon destruction
  12963. if (instance.state.isMounted) {
  12964. hide(0);
  12965. }
  12966. removeTriggersFromReference();
  12967. delete reference._tippy;
  12968. var target = instance.props.target;
  12969. if (target && destroyTargetInstances && isRealElement(reference)) {
  12970. arrayFrom(reference.querySelectorAll(target)).forEach(function (child) {
  12971. if (child._tippy) {
  12972. child._tippy.destroy();
  12973. }
  12974. });
  12975. }
  12976. if (instance.popperInstance) {
  12977. instance.popperInstance.destroy();
  12978. }
  12979. isBeingDestroyed = false;
  12980. instance.state.isDestroyed = true;
  12981. }
  12982. }
  12983. /**
  12984. * Groups an array of instances by taking control of their props during
  12985. * certain lifecycles.
  12986. */
  12987. function group(instances) {
  12988. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  12989. _ref$delay = _ref.delay,
  12990. delay = _ref$delay === void 0 ? instances[0].props.delay : _ref$delay,
  12991. _ref$duration = _ref.duration,
  12992. duration = _ref$duration === void 0 ? 0 : _ref$duration;
  12993. var isAnyTippyOpen = false;
  12994. instances.forEach(function (instance) {
  12995. if (instance._originalProps) {
  12996. instance.set(instance._originalProps);
  12997. } else {
  12998. instance._originalProps = _extends({}, instance.props);
  12999. }
  13000. });
  13001. function setIsAnyTippyOpen(value) {
  13002. isAnyTippyOpen = value;
  13003. updateInstances();
  13004. }
  13005. function onShow(instance) {
  13006. instance._originalProps.onShow(instance);
  13007. instances.forEach(function (instance) {
  13008. instance.set({
  13009. duration: duration
  13010. });
  13011. if (instance.state.isVisible) {
  13012. instance.hide();
  13013. }
  13014. });
  13015. setIsAnyTippyOpen(true);
  13016. }
  13017. function onHide(instance) {
  13018. instance._originalProps.onHide(instance);
  13019. setIsAnyTippyOpen(false);
  13020. }
  13021. function onShown(instance) {
  13022. instance._originalProps.onShown(instance);
  13023. instance.set({
  13024. duration: instance._originalProps.duration
  13025. });
  13026. }
  13027. function updateInstances() {
  13028. instances.forEach(function (instance) {
  13029. instance.set({
  13030. onShow: onShow,
  13031. onShown: onShown,
  13032. onHide: onHide,
  13033. delay: isAnyTippyOpen ? [0, Array.isArray(delay) ? delay[1] : delay] : delay,
  13034. duration: isAnyTippyOpen ? duration : instance._originalProps.duration
  13035. });
  13036. });
  13037. }
  13038. updateInstances();
  13039. }
  13040. var globalEventListenersBound = false;
  13041. /**
  13042. * Exported module
  13043. */
  13044. function tippy(targets, options) {
  13045. validateOptions(options || {}, defaultProps);
  13046. if (!globalEventListenersBound) {
  13047. bindGlobalEventListeners();
  13048. globalEventListenersBound = true;
  13049. }
  13050. var props = _extends({}, defaultProps, options); // If they are specifying a virtual positioning reference, we need to polyfill
  13051. // some native DOM props
  13052. if (isBareVirtualElement(targets)) {
  13053. polyfillElementPrototypeProperties(targets);
  13054. }
  13055. var instances = getArrayOfElements(targets).reduce(function (acc, reference) {
  13056. var instance = reference && createTippy(reference, props);
  13057. if (instance) {
  13058. acc.push(instance);
  13059. }
  13060. return acc;
  13061. }, []);
  13062. return isSingular(targets) ? instances[0] : instances;
  13063. }
  13064. /**
  13065. * Static props
  13066. */
  13067. tippy.version = version;
  13068. tippy.defaults = defaultProps;
  13069. /**
  13070. * Static methods
  13071. */
  13072. tippy.setDefaults = function (partialDefaults) {
  13073. Object.keys(partialDefaults).forEach(function (key) {
  13074. // @ts-ignore
  13075. defaultProps[key] = partialDefaults[key];
  13076. });
  13077. };
  13078. tippy.hideAll = hideAll;
  13079. tippy.group = group;
  13080. /**
  13081. * Auto-init tooltips for elements with a `data-tippy="..."` attribute
  13082. */
  13083. function autoInit() {
  13084. arrayFrom(document.querySelectorAll('[data-tippy]')).forEach(function (el) {
  13085. var content = el.getAttribute('data-tippy');
  13086. if (content) {
  13087. tippy(el, {
  13088. content: content
  13089. });
  13090. }
  13091. });
  13092. }
  13093. if (isBrowser) {
  13094. setTimeout(autoInit);
  13095. }
  13096. /**
  13097. * Injects a string of CSS styles to a style node in <head>
  13098. */
  13099. function injectCSS(css) {
  13100. if (isBrowser) {
  13101. var style = document.createElement('style');
  13102. style.type = 'text/css';
  13103. style.textContent = css;
  13104. style.setAttribute('data-tippy-stylesheet', '');
  13105. var head = document.head;
  13106. var firstChild = head.firstChild;
  13107. if (firstChild) {
  13108. head.insertBefore(style, firstChild);
  13109. } else {
  13110. head.appendChild(style);
  13111. }
  13112. }
  13113. }
  13114. injectCSS(css);
  13115. /* harmony default export */ __webpack_exports__["default"] = (tippy);
  13116. //# sourceMappingURL=index.all.js.map
  13117. /***/ }),
  13118. /***/ "./node_modules/uuid/lib/bytesToUuid.js":
  13119. /*!**********************************************!*\
  13120. !*** ./node_modules/uuid/lib/bytesToUuid.js ***!
  13121. \**********************************************/
  13122. /*! no static exports found */
  13123. /***/ (function(module, exports) {
  13124. /**
  13125. * Convert array of 16 byte values to UUID string format of the form:
  13126. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  13127. */
  13128. var byteToHex = [];
  13129. for (var i = 0; i < 256; ++i) {
  13130. byteToHex[i] = (i + 0x100).toString(16).substr(1);
  13131. }
  13132. function bytesToUuid(buf, offset) {
  13133. var i = offset || 0;
  13134. var bth = byteToHex;
  13135. // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  13136. return ([bth[buf[i++]], bth[buf[i++]],
  13137. bth[buf[i++]], bth[buf[i++]], '-',
  13138. bth[buf[i++]], bth[buf[i++]], '-',
  13139. bth[buf[i++]], bth[buf[i++]], '-',
  13140. bth[buf[i++]], bth[buf[i++]], '-',
  13141. bth[buf[i++]], bth[buf[i++]],
  13142. bth[buf[i++]], bth[buf[i++]],
  13143. bth[buf[i++]], bth[buf[i++]]]).join('');
  13144. }
  13145. module.exports = bytesToUuid;
  13146. /***/ }),
  13147. /***/ "./node_modules/uuid/lib/rng-browser.js":
  13148. /*!**********************************************!*\
  13149. !*** ./node_modules/uuid/lib/rng-browser.js ***!
  13150. \**********************************************/
  13151. /*! no static exports found */
  13152. /***/ (function(module, exports) {
  13153. // Unique ID creation requires a high quality random # generator. In the
  13154. // browser this is a little complicated due to unknown quality of Math.random()
  13155. // and inconsistent support for the `crypto` API. We do the best we can via
  13156. // feature-detection
  13157. // getRandomValues needs to be invoked in a context where "this" is a Crypto
  13158. // implementation. Also, find the complete implementation of crypto on IE11.
  13159. var getRandomValues = (typeof(crypto) != 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto)) ||
  13160. (typeof(msCrypto) != 'undefined' && typeof window.msCrypto.getRandomValues == 'function' && msCrypto.getRandomValues.bind(msCrypto));
  13161. if (getRandomValues) {
  13162. // WHATWG crypto RNG - http://wiki.whatwg.org/wiki/Crypto
  13163. var rnds8 = new Uint8Array(16); // eslint-disable-line no-undef
  13164. module.exports = function whatwgRNG() {
  13165. getRandomValues(rnds8);
  13166. return rnds8;
  13167. };
  13168. } else {
  13169. // Math.random()-based (RNG)
  13170. //
  13171. // If all else fails, use Math.random(). It's fast, but is of unspecified
  13172. // quality.
  13173. var rnds = new Array(16);
  13174. module.exports = function mathRNG() {
  13175. for (var i = 0, r; i < 16; i++) {
  13176. if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
  13177. rnds[i] = r >>> ((i & 0x03) << 3) & 0xff;
  13178. }
  13179. return rnds;
  13180. };
  13181. }
  13182. /***/ }),
  13183. /***/ "./node_modules/uuid/v1.js":
  13184. /*!*********************************!*\
  13185. !*** ./node_modules/uuid/v1.js ***!
  13186. \*********************************/
  13187. /*! no static exports found */
  13188. /***/ (function(module, exports, __webpack_require__) {
  13189. var rng = __webpack_require__(/*! ./lib/rng */ "./node_modules/uuid/lib/rng-browser.js");
  13190. var bytesToUuid = __webpack_require__(/*! ./lib/bytesToUuid */ "./node_modules/uuid/lib/bytesToUuid.js");
  13191. // **`v1()` - Generate time-based UUID**
  13192. //
  13193. // Inspired by https://github.com/LiosK/UUID.js
  13194. // and http://docs.python.org/library/uuid.html
  13195. var _nodeId;
  13196. var _clockseq;
  13197. // Previous uuid creation time
  13198. var _lastMSecs = 0;
  13199. var _lastNSecs = 0;
  13200. // See https://github.com/broofa/node-uuid for API details
  13201. function v1(options, buf, offset) {
  13202. var i = buf && offset || 0;
  13203. var b = buf || [];
  13204. options = options || {};
  13205. var node = options.node || _nodeId;
  13206. var clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq;
  13207. // node and clockseq need to be initialized to random values if they're not
  13208. // specified. We do this lazily to minimize issues related to insufficient
  13209. // system entropy. See #189
  13210. if (node == null || clockseq == null) {
  13211. var seedBytes = rng();
  13212. if (node == null) {
  13213. // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1)
  13214. node = _nodeId = [
  13215. seedBytes[0] | 0x01,
  13216. seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]
  13217. ];
  13218. }
  13219. if (clockseq == null) {
  13220. // Per 4.2.2, randomize (14 bit) clockseq
  13221. clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff;
  13222. }
  13223. }
  13224. // UUID timestamps are 100 nano-second units since the Gregorian epoch,
  13225. // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so
  13226. // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs'
  13227. // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00.
  13228. var msecs = options.msecs !== undefined ? options.msecs : new Date().getTime();
  13229. // Per 4.2.1.2, use count of uuid's generated during the current clock
  13230. // cycle to simulate higher resolution clock
  13231. var nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1;
  13232. // Time since last uuid creation (in msecs)
  13233. var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000;
  13234. // Per 4.2.1.2, Bump clockseq on clock regression
  13235. if (dt < 0 && options.clockseq === undefined) {
  13236. clockseq = clockseq + 1 & 0x3fff;
  13237. }
  13238. // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new
  13239. // time interval
  13240. if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) {
  13241. nsecs = 0;
  13242. }
  13243. // Per 4.2.1.2 Throw error if too many uuids are requested
  13244. if (nsecs >= 10000) {
  13245. throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec');
  13246. }
  13247. _lastMSecs = msecs;
  13248. _lastNSecs = nsecs;
  13249. _clockseq = clockseq;
  13250. // Per 4.1.4 - Convert from unix epoch to Gregorian epoch
  13251. msecs += 12219292800000;
  13252. // `time_low`
  13253. var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000;
  13254. b[i++] = tl >>> 24 & 0xff;
  13255. b[i++] = tl >>> 16 & 0xff;
  13256. b[i++] = tl >>> 8 & 0xff;
  13257. b[i++] = tl & 0xff;
  13258. // `time_mid`
  13259. var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff;
  13260. b[i++] = tmh >>> 8 & 0xff;
  13261. b[i++] = tmh & 0xff;
  13262. // `time_high_and_version`
  13263. b[i++] = tmh >>> 24 & 0xf | 0x10; // include version
  13264. b[i++] = tmh >>> 16 & 0xff;
  13265. // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant)
  13266. b[i++] = clockseq >>> 8 | 0x80;
  13267. // `clock_seq_low`
  13268. b[i++] = clockseq & 0xff;
  13269. // `node`
  13270. for (var n = 0; n < 6; ++n) {
  13271. b[i + n] = node[n];
  13272. }
  13273. return buf ? buf : bytesToUuid(b);
  13274. }
  13275. module.exports = v1;
  13276. /***/ }),
  13277. /***/ "./node_modules/webpack/buildin/global.js":
  13278. /*!***********************************!*\
  13279. !*** (webpack)/buildin/global.js ***!
  13280. \***********************************/
  13281. /*! no static exports found */
  13282. /***/ (function(module, exports) {
  13283. var g;
  13284. // This works in non-strict mode
  13285. g = (function() {
  13286. return this;
  13287. })();
  13288. try {
  13289. // This works if eval is allowed (see CSP)
  13290. g = g || new Function("return this")();
  13291. } catch (e) {
  13292. // This works if the window reference is available
  13293. if (typeof window === "object") g = window;
  13294. }
  13295. // g can still be undefined, but nothing to do about it...
  13296. // We return undefined, instead of nothing here, so it's
  13297. // easier to handle this case. if(!global) { ...}
  13298. module.exports = g;
  13299. /***/ }),
  13300. /***/ "./src/assets/arrow.svg":
  13301. /*!******************************!*\
  13302. !*** ./src/assets/arrow.svg ***!
  13303. \******************************/
  13304. /*! no static exports found */
  13305. /***/ (function(module, exports) {
  13306. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path d=\"M313.941 216H12c-6.627 0-12 5.373-12 12v56c0 6.627 5.373 12 12 12h301.941v46.059c0 21.382 25.851 32.09 40.971 16.971l86.059-86.059c9.373-9.373 9.373-24.569 0-33.941l-86.059-86.059c-15.119-15.119-40.971-4.411-40.971 16.971V216z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13307. /***/ }),
  13308. /***/ "./src/assets/bx-left-arrow.svg":
  13309. /*!**************************************!*\
  13310. !*** ./src/assets/bx-left-arrow.svg ***!
  13311. \**************************************/
  13312. /*! no static exports found */
  13313. /***/ (function(module, exports) {
  13314. module.exports = "<svg t=\"1553418887330\" class=\"icon\" style viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2264\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\"></style></defs><path d=\"M787.797333 90.197333a42.581333 42.581333 0 0 0-44.074666 2.688l-554.666667 384a42.794667 42.794667 0 0 0 0 70.186667l554.666667 384A42.666667 42.666667 0 0 0 810.666667 896V128a42.666667 42.666667 0 0 0-22.869334-37.802667zM725.333333 814.549333L288.298667 512 725.333333 209.450667v605.098666z\" p-id=\"2265\"></path></svg>"
  13315. /***/ }),
  13316. /***/ "./src/assets/bx-right-arrow.svg":
  13317. /*!***************************************!*\
  13318. !*** ./src/assets/bx-right-arrow.svg ***!
  13319. \***************************************/
  13320. /*! no static exports found */
  13321. /***/ (function(module, exports) {
  13322. module.exports = "<svg t=\"1553418900235\" class=\"icon\" style viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2709\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\"></style></defs><path d=\"M236.202667 933.802667a42.837333 42.837333 0 0 0 44.074666-2.730667l554.666667-384a42.666667 42.666667 0 0 0 0-70.144l-554.666667-384A42.581333 42.581333 0 0 0 213.333333 128v768a42.666667 42.666667 0 0 0 22.869334 37.802667zM298.666667 209.450667L735.701333 512 298.666667 814.549333V209.450667z\" p-id=\"2710\"></path></svg>"
  13323. /***/ }),
  13324. /***/ "./src/assets/check.svg":
  13325. /*!******************************!*\
  13326. !*** ./src/assets/check.svg ***!
  13327. \******************************/
  13328. /*! no static exports found */
  13329. /***/ (function(module, exports) {
  13330. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M173.898 439.404l-166.4-166.4c-9.997-9.997-9.997-26.206 0-36.204l36.203-36.204c9.997-9.998 26.207-9.998 36.204 0L192 312.69 432.095 72.596c9.997-9.997 26.207-9.997 36.204 0l36.203 36.204c9.997 9.997 9.997 26.206 0 36.204l-294.4 294.401c-9.998 9.997-26.207 9.997-36.204-.001z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13331. /***/ }),
  13332. /***/ "./src/assets/cover.svg":
  13333. /*!******************************!*\
  13334. !*** ./src/assets/cover.svg ***!
  13335. \******************************/
  13336. /*! no static exports found */
  13337. /***/ (function(module, exports) {
  13338. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path d=\"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13339. /***/ }),
  13340. /***/ "./src/assets/drag.svg":
  13341. /*!*****************************!*\
  13342. !*** ./src/assets/drag.svg ***!
  13343. \*****************************/
  13344. /*! no static exports found */
  13345. /***/ (function(module, exports) {
  13346. module.exports = "<svg t=\"1555470391343\" class=\"icon\" style viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2050\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" id=\"drag-handler\"><defs><style type=\"text/css\"></style></defs><path d=\"M298.666667 810.666667v-85.333334h85.333333v85.333334H298.666667m170.666666 0v-85.333334h85.333334v85.333334h-85.333334m170.666667 0v-85.333334h85.333333v85.333334h-85.333333m-341.333333-170.666667v-85.333333h85.333333v85.333333H298.666667m170.666666 0v-85.333333h85.333334v85.333333h-85.333334m170.666667 0v-85.333333h85.333333v85.333333h-85.333333m-341.333333-170.666667V384h85.333333v85.333333H298.666667m170.666666 0V384h85.333334v85.333333h-85.333334m170.666667 0V384h85.333333v85.333333h-85.333333M298.666667 298.666667V213.333333h85.333333v85.333334H298.666667m170.666666 0V213.333333h85.333334v85.333334h-85.333334m170.666667 0V213.333333h85.333333v85.333334h-85.333333z\" fill p-id=\"2051\"></path></svg>"
  13347. /***/ }),
  13348. /***/ "./src/assets/eraser.svg":
  13349. /*!*******************************!*\
  13350. !*** ./src/assets/eraser.svg ***!
  13351. \*******************************/
  13352. /*! no static exports found */
  13353. /***/ (function(module, exports) {
  13354. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 512 512\"><path d=\"M497.941 273.941c18.745-18.745 18.745-49.137 0-67.882l-160-160c-18.745-18.745-49.136-18.746-67.883 0l-256 256c-18.745 18.745-18.745 49.137 0 67.882l96 96A48.004 48.004 0 0 0 144 480h356c6.627 0 12-5.373 12-12v-40c0-6.627-5.373-12-12-12H355.883l142.058-142.059zm-302.627-62.627l137.373 137.373L265.373 416H150.628l-80-80 124.686-124.686z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13355. /***/ }),
  13356. /***/ "./src/assets/finish.svg":
  13357. /*!*******************************!*\
  13358. !*** ./src/assets/finish.svg ***!
  13359. \*******************************/
  13360. /*! no static exports found */
  13361. /***/ (function(module, exports) {
  13362. module.exports = "<svg style=\"height:20px;\" viewBox=\"0 0 18 18\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><title>teacher_ppt_bar_btn_finish</title><desc>Created with Sketch.</desc><g id=\"Demo\" stroke=\"none\" stroke-width=\"1\" fill=\"none\" fill-rule=\"evenodd\" fill-opacity=\"0.776211504\"><g id=\"教师端_白板\" transform=\"translate(-957.000000, -578.000000)\" fill=\"#FF3366\"><g id=\"分组-6\" transform=\"translate(484.000000, 569.000000)\"><g id=\"Group-29\"><g id=\"teacher_ppt_bar_bj\"><g id=\"分组-10\" transform=\"translate(382.000000, 9.000000)\"><g id=\"分组-5\"><g id=\"teacher_ppt_bar_btn_finish\" transform=\"translate(91.000000, 0.000000)\"><g id=\"icon/ppt/结束\"><g id=\"结束\" transform=\"translate(3.000000, 3.000000)\"><path d=\"M6.13493151,13 C5.30684932,13 4.50547945,12.839726 3.77534247,12.5191781 C3.03630137,12.1986301 2.38630137,11.7534247 1.83424658,11.210274 C1.28219178,10.6671233 0.845890411,10.0082192 0.525342466,9.27808219 C0.204794521,8.5390411 0.0445205479,7.73767123 0.0445205479,6.90068493 C0.0445205479,6.41986301 0.0979452055,5.94794521 0.21369863,5.48493151 C0.329452055,5.02191781 0.489726027,4.57671233 0.694520548,4.15821918 C0.899315068,3.73972603 1.16643836,3.34794521 1.46917808,2.99178082 C1.78082192,2.62671233 2.12808219,2.29726027 2.5109589,2.00342466 C2.64452055,1.90547945 2.77808219,1.8609589 2.92945205,1.8609589 C2.96506849,1.8609589 3.00068493,1.8609589 3.04520548,1.86986301 C3.24109589,1.89657534 3.39246575,1.99452055 3.51712329,2.15479452 C3.64178082,2.31506849 3.67739726,2.48424658 3.65068493,2.68013699 C3.6239726,2.8760274 3.5260274,3.03630137 3.36575342,3.15205479 C2.76027397,3.58835616 2.27945205,4.14041096 1.95890411,4.79041096 C1.63835616,5.44041096 1.46917808,6.14383562 1.46917808,6.89178082 C1.46917808,7.53287671 1.59383562,8.13835616 1.83424658,8.70821918 C2.07465753,9.27808219 2.4130137,9.77671233 2.83150685,10.1952055 C3.25,10.6136986 3.74863014,10.9520548 4.31849315,11.2013699 C4.88835616,11.4506849 5.49383562,11.5753425 6.13493151,11.5753425 C6.7760274,11.5753425 7.39041096,11.4506849 7.95136986,11.2013699 C8.51232877,10.9520548 9.01986301,10.6136986 9.43835616,10.1952055 C9.85684932,9.77671233 10.1952055,9.27808219 10.4445205,8.70821918 C10.6938356,8.13835616 10.8184932,7.53287671 10.8184932,6.89178082 C10.8184932,6.13493151 10.640411,5.41369863 10.2931507,4.7369863 C9.94589041,4.06027397 9.44726027,3.49931507 8.81506849,3.0630137 C8.64589041,2.94726027 8.54794521,2.79589041 8.52123288,2.6 C8.48561644,2.40410959 8.53013699,2.2260274 8.6369863,2.05684932 C8.74383562,1.90547945 8.89520548,1.80753425 9.09109589,1.77191781 C9.13561644,1.7630137 9.18013699,1.7630137 9.22465753,1.7630137 C9.36712329,1.7630137 9.50068493,1.80753425 9.63424658,1.89657534 C10.0349315,2.18150685 10.4089041,2.51986301 10.7205479,2.88493151 C11.0410959,3.25 11.3171233,3.65068493 11.539726,4.07808219 C11.7623288,4.50547945 11.940411,4.95958904 12.0561644,5.43150685 C12.1719178,5.90342466 12.2342466,6.39315068 12.2342466,6.88287671 C12.2342466,7.71986301 12.0739726,8.52123288 11.7534247,9.26027397 C11.4328767,9.99931507 10.9876712,10.6493151 10.4445205,11.2013699 C9.90136986,11.7445205 9.24246575,12.189726 8.50342466,12.510274 C7.78219178,12.839726 6.98082192,13 6.13493151,13 Z M6.13493151,6.75821918 C5.9390411,6.75821918 5.77876712,6.6869863 5.63630137,6.55342466 C5.50273973,6.4109589 5.43150685,6.25068493 5.43150685,6.05479452 L5.43150685,0.721232877 C5.43150685,0.525342466 5.50273973,0.356164384 5.63630137,0.21369863 C5.77876712,0.0712328767 5.9390411,0 6.13493151,0 C6.33972603,0 6.50890411,0.0712328767 6.64246575,0.21369863 C6.78493151,0.356164384 6.84726027,0.525342466 6.84726027,0.721232877 L6.84726027,6.05479452 C6.84726027,6.25068493 6.7760274,6.4109589 6.64246575,6.55342466 C6.50890411,6.6869863 6.33972603,6.75821918 6.13493151,6.75821918 Z\" id=\"Shape\" fill-rule=\"nonzero\"></path></g></g></g></g></g></g></g></g></g></g></svg>"
  13363. /***/ }),
  13364. /***/ "./src/assets/highlight.svg":
  13365. /*!**********************************!*\
  13366. !*** ./src/assets/highlight.svg ***!
  13367. \**********************************/
  13368. /*! no static exports found */
  13369. /***/ (function(module, exports) {
  13370. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 544 512\"><path d=\"M0 479.98L99.92 512l35.45-35.45-67.04-67.04L0 479.98zm124.61-240.01a36.592 36.592 0 0 0-10.79 38.1l13.05 42.83-50.93 50.94 96.23 96.23 50.86-50.86 42.74 13.08c13.73 4.2 28.65-.01 38.15-10.78l35.55-41.64-173.34-173.34-41.52 35.44zm403.31-160.7l-63.2-63.2c-20.49-20.49-53.38-21.52-75.12-2.35L190.55 183.68l169.77 169.78L530.27 154.4c19.18-21.74 18.15-54.63-2.35-75.13z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13371. /***/ }),
  13372. /***/ "./src/assets/line.svg":
  13373. /*!*****************************!*\
  13374. !*** ./src/assets/line.svg ***!
  13375. \*****************************/
  13376. /*! no static exports found */
  13377. /***/ (function(module, exports) {
  13378. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 640 512\"><path d=\"M594.53 508.63L6.18 53.9c-6.97-5.42-8.23-15.47-2.81-22.45L23.01 6.18C28.43-.8 38.49-2.06 45.47 3.37L633.82 458.1c6.97 5.42 8.23 15.47 2.81 22.45l-19.64 25.27c-5.42 6.98-15.48 8.23-22.46 2.81z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13379. /***/ }),
  13380. /***/ "./src/assets/rect.svg":
  13381. /*!*****************************!*\
  13382. !*** ./src/assets/rect.svg ***!
  13383. \*****************************/
  13384. /*! no static exports found */
  13385. /***/ (function(module, exports) {
  13386. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path d=\"M400 32H48C21.5 32 0 53.5 0 80v352c0 26.5 21.5 48 48 48h352c26.5 0 48-21.5 48-48V80c0-26.5-21.5-48-48-48zm-6 400H54c-3.3 0-6-2.7-6-6V86c0-3.3 2.7-6 6-6h340c3.3 0 6 2.7 6 6v340c0 3.3-2.7 6-6 6z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13387. /***/ }),
  13388. /***/ "./src/assets/rollback.svg":
  13389. /*!*********************************!*\
  13390. !*** ./src/assets/rollback.svg ***!
  13391. \*********************************/
  13392. /*! no static exports found */
  13393. /***/ (function(module, exports) {
  13394. module.exports = "<svg t=\"1560078592996\" class=\"icon\" style viewBox=\"0 0 1024 1024\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" p-id=\"2653\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"><defs><style type=\"text/css\"></style></defs><path d=\"M811.488 424.512Q722.976 336 597.984 336h-336l114.016-114.016q12-12 12-28.512t-12-28-28.512-11.488-28.512 12l-183.008 183.008q-12 12-12 28.512t12 28.512l178.016 178.016q12 12 28.512 12t28-11.488 11.488-28-11.008-28.512l-112.992-112h340q92 0 156.992 64.992t64.992 156.992v192q0 16.992 12 28.512t28.512 11.488 28-11.488 11.488-28.512v-192q0-124.992-88.512-213.504z\" p-id=\"2654\" fill=\"#2c2c2c\"></path></svg>"
  13395. /***/ }),
  13396. /***/ "./src/assets/text.svg":
  13397. /*!*****************************!*\
  13398. !*** ./src/assets/text.svg ***!
  13399. \*****************************/
  13400. /*! no static exports found */
  13401. /***/ (function(module, exports) {
  13402. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448 512\"><path d=\"M152 416h-24.013l26.586-80.782H292.8L319.386 416H296c-8.837 0-16 7.163-16 16v32c0 8.837 7.163 16 16 16h136c8.837 0 16-7.163 16-16v-32c0-8.837-7.163-16-16-16h-26.739L275.495 42.746A16 16 0 0 0 260.382 32h-72.766a16 16 0 0 0-15.113 10.746L42.739 416H16c-8.837 0-16 7.163-16 16v32c0 8.837 7.163 16 16 16h136c8.837 0 16-7.163 16-16v-32c0-8.837-7.163-16-16-16zm64.353-271.778c4.348-15.216 6.61-28.156 7.586-34.644.839 6.521 2.939 19.476 7.727 34.706l41.335 124.006h-98.619l41.971-124.068z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13403. /***/ }),
  13404. /***/ "./src/assets/times.svg":
  13405. /*!******************************!*\
  13406. !*** ./src/assets/times.svg ***!
  13407. \******************************/
  13408. /*! no static exports found */
  13409. /***/ (function(module, exports) {
  13410. module.exports = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 352 512\"><path d=\"M242.72 256l100.07-100.07c12.28-12.28 12.28-32.19 0-44.48l-22.24-22.24c-12.28-12.28-32.19-12.28-44.48 0L176 189.28 75.93 89.21c-12.28-12.28-32.19-12.28-44.48 0L9.21 111.45c-12.28 12.28-12.28 32.19 0 44.48L109.28 256 9.21 356.07c-12.28 12.28-12.28 32.19 0 44.48l22.24 22.24c12.28 12.28 32.2 12.28 44.48 0L176 322.72l100.07 100.07c12.28 12.28 32.2 12.28 44.48 0l22.24-22.24c12.28-12.28 12.28-32.19 0-44.48L242.72 256z\"></path></svg><!-- Font Awesome Free 5.5.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) -->"
  13411. /***/ }),
  13412. /***/ "./src/drawboard/Baseboard/index.ts":
  13413. /*!******************************************!*\
  13414. !*** ./src/drawboard/Baseboard/index.ts ***!
  13415. \******************************************/
  13416. /*! no static exports found */
  13417. /***/ (function(module, exports, __webpack_require__) {
  13418. "use strict";
  13419. Object.defineProperty(exports, "__esModule", { value: true });
  13420. var uuid_1 = __webpack_require__(/*! ./../../utils/uuid */ "./src/utils/uuid.ts");
  13421. var index_1 = __webpack_require__(/*! ./../../renderer/SvgHelper/index */ "./src/renderer/SvgHelper/index.ts");
  13422. var Baseboard = function () {
  13423. function Baseboard(source) {
  13424. var _this = this;
  13425. this.id = uuid_1.uuid();
  13426. this.isFullscreen = false;
  13427. this.initBoard = function (mountContainer) {
  13428. _this.boardHolder = document.createElement('div');
  13429. _this.boardHolder.id = "fcw-board-holder-" + _this.id;
  13430. _this.boardHolder.className = "fcw-board-holder";
  13431. _this.boardHolder.style.zIndex = '999';
  13432. _this.boardHolder.style.setProperty('touch-action', 'none');
  13433. _this.boardHolder.style.setProperty('-ms-touch-action', 'none');
  13434. mountContainer.appendChild(_this.boardHolder);
  13435. _this.boardCanvas = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
  13436. _this.boardCanvas.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
  13437. _this.boardCanvas.setAttribute('width', _this.width.toString());
  13438. _this.boardCanvas.setAttribute('height', _this.height.toString());
  13439. _this.boardCanvas.setAttribute('viewBox', '0 0 ' + _this.width.toString() + ' ' + _this.height.toString());
  13440. _this.boardHolder.style.position = 'fixed';
  13441. _this.boardHolder.style.width = _this.width + "px";
  13442. _this.boardHolder.style.height = _this.height + "px";
  13443. _this.boardHolder.style.transformOrigin = 'top left';
  13444. _this.positionBoard();
  13445. _this.defs = index_1.SvgHelper.createDefs();
  13446. _this.boardCanvas.appendChild(_this.defs);
  13447. _this.boardHolder.appendChild(_this.boardCanvas);
  13448. };
  13449. this.positionBoard = function () {
  13450. _this.boardHolder.style.top = _this.targetRect.top + 'px';
  13451. _this.boardHolder.style.left = _this.targetRect.left + 'px';
  13452. };
  13453. this.source = source;
  13454. if (source.imgEle) {
  13455. this.target = source.imgEle;
  13456. this.width = this.target.clientWidth;
  13457. this.height = this.target.clientHeight;
  13458. }
  13459. }
  13460. return Baseboard;
  13461. }();
  13462. exports.Baseboard = Baseboard;
  13463. /***/ }),
  13464. /***/ "./src/drawboard/Drawboard/index.less":
  13465. /*!********************************************!*\
  13466. !*** ./src/drawboard/Drawboard/index.less ***!
  13467. \********************************************/
  13468. /*! no static exports found */
  13469. /***/ (function(module, exports, __webpack_require__) {
  13470. var content = __webpack_require__(/*! !../../../node_modules/css-loader/dist/cjs.js??ref--11-1!../../../node_modules/postcss-loader/src!../../../node_modules/less-loader/dist/cjs.js??ref--11-3!./index.less */ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/drawboard/Drawboard/index.less");
  13471. if(typeof content === 'string') content = [[module.i, content, '']];
  13472. var transform;
  13473. var insertInto;
  13474. var options = {"hmr":true}
  13475. options.transform = transform
  13476. options.insertInto = undefined;
  13477. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  13478. if(content.locals) module.exports = content.locals;
  13479. if(false) {}
  13480. /***/ }),
  13481. /***/ "./src/drawboard/Drawboard/index.ts":
  13482. /*!******************************************!*\
  13483. !*** ./src/drawboard/Drawboard/index.ts ***!
  13484. \******************************************/
  13485. /*! no static exports found */
  13486. /***/ (function(module, exports, __webpack_require__) {
  13487. "use strict";
  13488. var __extends = this && this.__extends || function () {
  13489. var extendStatics = function (d, b) {
  13490. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13491. d.__proto__ = b;
  13492. } || function (d, b) {
  13493. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13494. };
  13495. return extendStatics(d, b);
  13496. };
  13497. return function (d, b) {
  13498. extendStatics(d, b);
  13499. function __() {
  13500. this.constructor = d;
  13501. }
  13502. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13503. };
  13504. }();
  13505. Object.defineProperty(exports, "__esModule", { value: true });
  13506. var fc_hotkeys_1 = __webpack_require__(/*! fc-hotkeys */ "./node_modules/fc-hotkeys/dist/index.js");
  13507. var debounce = __webpack_require__(/*! lodash.debounce */ "./node_modules/lodash.debounce/index.js");
  13508. var index_1 = __webpack_require__(/*! ./../Baseboard/index */ "./src/drawboard/Baseboard/index.ts");
  13509. var toolbar_items_1 = __webpack_require__(/*! ./../../toolbar/toolbar-items */ "./src/toolbar/toolbar-items.ts");
  13510. var Synthetizer_1 = __webpack_require__(/*! ../../renderer/Synthetizer */ "./src/renderer/Synthetizer/index.ts");
  13511. var Toolbar_1 = __webpack_require__(/*! ../../toolbar/Toolbar */ "./src/toolbar/Toolbar.ts");
  13512. __webpack_require__(/*! ./index.less */ "./src/drawboard/Drawboard/index.less");
  13513. var layout_1 = __webpack_require__(/*! ../../utils/layout */ "./src/utils/layout.ts");
  13514. var index_2 = __webpack_require__(/*! ../../markers/RectMarker/index */ "./src/markers/RectMarker/index.ts");
  13515. var index_3 = __webpack_require__(/*! ../../markers/HighlightMarker/index */ "./src/markers/HighlightMarker/index.ts");
  13516. var index_4 = __webpack_require__(/*! ../../markers/CoverMarker/index */ "./src/markers/CoverMarker/index.ts");
  13517. var index_5 = __webpack_require__(/*! ../../markers/LineMarker/index */ "./src/markers/LineMarker/index.ts");
  13518. var index_6 = __webpack_require__(/*! ../../markers/ArrowMarker/index */ "./src/markers/ArrowMarker/index.ts");
  13519. var index_7 = __webpack_require__(/*! ../../markers/TextMarker/index */ "./src/markers/TextMarker/index.ts");
  13520. var Drawboard = function (_super) {
  13521. __extends(Drawboard, _super);
  13522. function Drawboard(source, _a) {
  13523. var _b = _a === void 0 ? {} : _a,
  13524. _c = _b.allowKeyboard,
  13525. allowKeyboard = _c === void 0 ? true : _c,
  13526. extraToolbarItems = _b.extraToolbarItems,
  13527. mountContainer = _b.mountContainer,
  13528. page = _b.page,
  13529. zIndex = _b.zIndex,
  13530. onChange = _b.onChange;
  13531. var _this = _super.call(this, source) || this;
  13532. _this.mountContainer = document.body;
  13533. _this.scale = 1.0;
  13534. _this.zIndex = 999;
  13535. _this.allowKeyboard = true;
  13536. _this.onComplete = function () {};
  13537. _this.onChange = function () {};
  13538. _this.open = function (onComplete, onCancel) {
  13539. if (onComplete) {
  13540. _this.onComplete = onComplete;
  13541. }
  13542. if (onCancel) {
  13543. _this.onCancel = onCancel;
  13544. }
  13545. _this.setTargetRect();
  13546. _this.initBoard(_this.mountContainer);
  13547. _this.attachEvents();
  13548. _this.setStyles();
  13549. window.addEventListener('resize', _this.adjustUI);
  13550. if (_this.page && _this.page.mode === 'master' || !_this.page) {
  13551. _this.showUI();
  13552. }
  13553. };
  13554. _this.hide = function () {
  13555. if (_this.source.imgSrc) {
  13556. _this.target.style.display = 'none';
  13557. }
  13558. _this.boardHolder.style.visibility = 'hidden';
  13559. _this.boardHolder.style.zIndex = '-1';
  13560. if (_this.toolbar) {
  13561. _this.toolbar.hide();
  13562. }
  13563. };
  13564. _this.show = function () {
  13565. if (_this.source.imgSrc) {
  13566. _this.target.style.display = 'block';
  13567. }
  13568. _this.boardHolder.style.visibility = 'visible';
  13569. _this.boardHolder.style.zIndex = "" + _this.zIndex;
  13570. if (_this.toolbar) {
  13571. _this.toolbar.show();
  13572. }
  13573. };
  13574. _this.destroy = function () {
  13575. if (_this.toolbarUI) {
  13576. _this.mountContainer.removeChild(_this.toolbarUI);
  13577. }
  13578. if (_this.boardCanvas) {
  13579. _this.mountContainer.removeChild(_this.boardHolder);
  13580. }
  13581. if (_this.listener) {
  13582. _this.listener.reset();
  13583. }
  13584. };
  13585. _this.render = function (onComplete, onCancel) {
  13586. _this.onComplete = onComplete;
  13587. if (onCancel) {
  13588. _this.onCancel = onCancel;
  13589. }
  13590. _this.selectMarker(null);
  13591. _this.startRender(_this.renderFinished);
  13592. };
  13593. _this.addMarker = function (markerType, _a) {
  13594. var _b = _a === void 0 ? {} : _a,
  13595. id = _b.id,
  13596. originX = _b.originX,
  13597. originY = _b.originY;
  13598. var marker = markerType.createMarker(_this.page);
  13599. if (id) {
  13600. marker.id = id;
  13601. }
  13602. marker.drawboard = _this;
  13603. marker.onSelected = _this.selectMarker;
  13604. marker.onChange = _this.onChange;
  13605. if (marker.defs && marker.defs.length > 0) {
  13606. for (var _i = 0, _c = marker.defs; _i < _c.length; _i++) {
  13607. var d = _c[_i];
  13608. if (d.id && !_this.boardCanvas.getElementById(d.id)) {
  13609. _this.defs.appendChild(d);
  13610. }
  13611. }
  13612. }
  13613. _this.markers.push(marker);
  13614. _this.selectMarker(marker);
  13615. _this.boardCanvas.appendChild(marker.visual);
  13616. var x;
  13617. var y;
  13618. if (originX && originY) {
  13619. x = originX;
  13620. y = originY;
  13621. } else {
  13622. var bbox = marker.visual.getBBox();
  13623. x = _this.width / 2 / _this.scale - bbox.width / 2;
  13624. y = _this.height / 2 / _this.scale - bbox.height / 2;
  13625. }
  13626. _this.onChange({
  13627. target: 'marker',
  13628. parentId: _this.page ? _this.page.id : _this.id,
  13629. event: 'addMarker',
  13630. marker: { type: marker.type, id: marker.id, dx: x, dy: y }
  13631. });
  13632. marker.moveTo(x, y);
  13633. return marker;
  13634. };
  13635. _this.deleteActiveMarker = function () {
  13636. _this.deleteMarkerWithEvent(_this.activeMarker);
  13637. };
  13638. _this.clearMarkers = function () {
  13639. _this.markers.slice().forEach(function (marker) {
  13640. _this.deleteMarkerWithEvent(marker);
  13641. });
  13642. };
  13643. _this.deleteMarkerWithEvent = function (marker) {
  13644. if (marker) {
  13645. if (_this.onChange) {
  13646. _this.onChange({
  13647. event: 'removeMarker',
  13648. id: marker.id,
  13649. target: 'marker',
  13650. marker: { id: marker.id }
  13651. });
  13652. }
  13653. _this.deleteMarker(marker);
  13654. }
  13655. };
  13656. _this.setTargetRect = function () {
  13657. var targetRect = _this.target.getBoundingClientRect();
  13658. var bodyRect = document.body.parentElement.getBoundingClientRect();
  13659. _this.targetRect = {
  13660. left: targetRect.left - bodyRect.left,
  13661. top: targetRect.top - bodyRect.top
  13662. };
  13663. };
  13664. _this.startRender = function (done) {
  13665. var renderer = new Synthetizer_1.Synthetizer();
  13666. renderer.rasterize(_this.target, _this.boardCanvas, done);
  13667. };
  13668. _this.attachEvents = function () {
  13669. _this.boardCanvas.addEventListener('mousedown', _this.mouseDown);
  13670. _this.boardCanvas.addEventListener('mousemove', _this.mouseMove);
  13671. _this.boardCanvas.addEventListener('mouseup', _this.mouseUp);
  13672. };
  13673. _this.mouseDown = function (ev) {
  13674. if (_this.activeMarker && (ev.buttons & 1) > 0) {
  13675. _this.activeMarker.deselect();
  13676. _this.activeMarker = null;
  13677. }
  13678. };
  13679. _this.mouseMove = function (ev) {
  13680. if (_this.activeMarker && (ev.buttons & 1) > 0) {
  13681. _this.activeMarker.manipulate(ev);
  13682. }
  13683. };
  13684. _this.mouseUp = function (ev) {
  13685. if (_this.activeMarker) {
  13686. _this.activeMarker.endManipulation();
  13687. }
  13688. };
  13689. _this.onKeyboard = function (e, _a) {
  13690. var hotkey = _a.hotkey;
  13691. switch (hotkey) {
  13692. case 'Shift+R':
  13693. _this.addMarker(index_2.RectMarker);
  13694. return;
  13695. case 'Shift+H':
  13696. _this.addMarker(index_3.HighlightMarker);
  13697. return;
  13698. case 'Shift+C':
  13699. _this.addMarker(index_4.CoverMarker);
  13700. return;
  13701. case 'Shift+L':
  13702. _this.addMarker(index_5.LineMarker);
  13703. return;
  13704. case 'Shift+A':
  13705. _this.addMarker(index_6.ArrowMarker);
  13706. return;
  13707. case 'Shift+T':
  13708. _this.addMarker(index_7.TextMarker);
  13709. return;
  13710. case 'ESC':
  13711. _this.page.whiteboard.rollbackSnap();
  13712. return;
  13713. default:
  13714. break;
  13715. }
  13716. if (!_this.activeMarker) {
  13717. return;
  13718. }
  13719. switch (hotkey) {
  13720. case 'UP':
  13721. _this.activeMarker.move(0, -10);
  13722. return;
  13723. case 'LEFT':
  13724. _this.activeMarker.move(-10, 0);
  13725. return;
  13726. case 'RIGHT':
  13727. _this.activeMarker.move(10, 0);
  13728. return;
  13729. case 'DOWN':
  13730. _this.activeMarker.move(0, 10);
  13731. return;
  13732. case 'BACKSPACE':
  13733. _this.deleteActiveMarker();
  13734. return;
  13735. default:
  13736. return;
  13737. }
  13738. };
  13739. _this.adjustUI = function (ev) {
  13740. _this.adjustSize();
  13741. _this.positionUI();
  13742. };
  13743. _this.adjustSize = function () {
  13744. _this.width = _this.target.clientWidth;
  13745. _this.height = _this.target.clientHeight;
  13746. var scale = _this.target.clientWidth / _this.boardHolder.clientWidth;
  13747. if (scale !== 1.0) {
  13748. _this.scale *= scale;
  13749. _this.boardHolder.style.width = _this.width + "px";
  13750. _this.boardHolder.style.height = _this.height + "px";
  13751. _this.boardHolder.style.transform = "scale(" + _this.scale + ")";
  13752. }
  13753. };
  13754. _this.positionUI = function () {
  13755. _this.setTargetRect();
  13756. _this.positionBoard();
  13757. _this.positionToolbar();
  13758. };
  13759. _this.positionToolbar = function () {
  13760. if (_this.toolbarUI && _this.targetRect) {
  13761. _this.toolbarUI.style.left = _this.targetRect.left + _this.target.offsetWidth - _this.toolbarUI.clientWidth + "px";
  13762. _this.toolbarUI.style.top = _this.targetRect.top - _this.toolbarUI.clientHeight + "px";
  13763. }
  13764. };
  13765. _this.showUI = function () {
  13766. _this.toolbar = new Toolbar_1.Toolbar(_this.toolbarItems, _this.toolbarClick);
  13767. _this.toolbar.zIndex = _this.zIndex + 1;
  13768. _this.toolbarUI = _this.toolbar.getUI(_this);
  13769. _this.boardHolder.appendChild(_this.toolbarUI);
  13770. _this.toolbarUI.style.position = 'absolute';
  13771. _this.positionToolbar();
  13772. _this.toolbar.show();
  13773. _this.toolbar.toolbarButtons.forEach(function (button) {
  13774. if (button.toolbarItem.draggable) {
  13775. button.container.draggable = true;
  13776. button.container.ondragstart = function (ev) {
  13777. if (ev) {
  13778. ev.dataTransfer.setData('id', button.id);
  13779. }
  13780. };
  13781. }
  13782. });
  13783. _this.boardCanvas.ondragover = function (ev) {
  13784. ev.preventDefault();
  13785. };
  13786. _this.boardCanvas.ondrop = function (ev) {
  13787. var markerX = ev.x;
  13788. var markerY = ev.y;
  13789. var rect = _this.boardHolder.getBoundingClientRect();
  13790. if (layout_1.rectContains(rect, { x: markerX, y: markerY })) {
  13791. var buttonId = ev.dataTransfer.getData('id');
  13792. var button = _this.toolbar.toolbarButtonMap[buttonId];
  13793. if (button.toolbarItem && button.toolbarItem.markerType) {
  13794. _this.addMarker(button.toolbarItem.markerType, {
  13795. originX: markerX - rect.left,
  13796. originY: markerY - rect.top
  13797. });
  13798. }
  13799. }
  13800. };
  13801. };
  13802. _this.setStyles = function () {
  13803. var editorStyleSheet = document.createElementNS('http://www.w3.org/2000/svg', 'style');
  13804. editorStyleSheet.innerHTML = "\n .rect-marker .render-visual {\n stroke: #ff0000;\n stroke-width: 3;\n fill: transparent;\n }\n .cover-marker .render-visual {\n stroke-width: 0;\n fill: #000000;\n }\n .highlight-marker .render-visual {\n stroke: transparent;\n stroke-width: 0;\n fill: #ffff00;\n fill-opacity: 0.4;\n }\n .line-marker .render-visual {\n stroke: #ff0000;\n stroke-width: 3;\n fill: transparent;\n }\n .arrow-marker .render-visual {\n stroke: #ff0000;\n stroke-width: 3;\n fill: transparent;\n }\n .arrow-marker-tip {\n stroke-width: 0;\n fill: #ff0000;\n }\n .text-marker text {\n fill: #ff0000;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\",\n Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\",\n \"Segoe UI Emoji\", \"Segoe UI Symbol\";\n }\n .fc-whiteboard-rect-control-box .fc-whiteboard-rect-control-rect {\n stroke: black;\n stroke-width: 1;\n stroke-opacity: 0.5;\n stroke-dasharray: 3, 2;\n fill: transparent;\n }\n .fc-whiteboard-control-grip {\n fill: #cccccc;\n stroke: #333333;\n stroke-width: 2;\n }\n ";
  13805. _this.boardCanvas.appendChild(editorStyleSheet);
  13806. };
  13807. _this.toolbarClick = function (ev, toolbarItem) {
  13808. if (toolbarItem.onClick) {
  13809. toolbarItem.onClick();
  13810. } else if (toolbarItem.markerType) {
  13811. _this.addMarker(toolbarItem.markerType);
  13812. } else {
  13813. switch (toolbarItem.name) {
  13814. case 'delete':
  13815. {
  13816. _this.deleteActiveMarker();
  13817. break;
  13818. }
  13819. case 'pointer':
  13820. {
  13821. if (_this.activeMarker) {
  13822. _this.selectMarker(null);
  13823. }
  13824. break;
  13825. }
  13826. case 'close':
  13827. {
  13828. _this.cancel();
  13829. break;
  13830. }
  13831. case 'ok':
  13832. {
  13833. _this.complete();
  13834. break;
  13835. }
  13836. default:
  13837. break;
  13838. }
  13839. }
  13840. };
  13841. _this.selectMarker = function (marker) {
  13842. if (_this.activeMarker && _this.activeMarker !== marker) {
  13843. _this.activeMarker.deselect();
  13844. }
  13845. _this.activeMarker = marker;
  13846. };
  13847. _this.deleteMarker = function (marker) {
  13848. _this.boardCanvas.removeChild(marker.visual);
  13849. if (_this.activeMarker === marker) {
  13850. _this.activeMarker = null;
  13851. }
  13852. _this.markers.splice(_this.markers.indexOf(marker), 1);
  13853. };
  13854. _this.complete = function () {
  13855. _this.selectMarker(null);
  13856. _this.startRender(_this.renderFinishedClose);
  13857. };
  13858. _this.cancel = function () {
  13859. _this.destroy();
  13860. if (_this.onCancel) {
  13861. _this.onCancel();
  13862. }
  13863. };
  13864. _this.renderFinished = function (dataUrl) {
  13865. _this.onComplete(dataUrl);
  13866. };
  13867. _this.renderFinishedClose = function (dataUrl) {
  13868. _this.destroy();
  13869. _this.onComplete(dataUrl);
  13870. };
  13871. if (page) {
  13872. _this.page = page;
  13873. }
  13874. if (zIndex) {
  13875. _this.zIndex = zIndex;
  13876. }
  13877. _this.allowKeyboard = allowKeyboard;
  13878. _this.markers = [];
  13879. _this.activeMarker = null;
  13880. var toolbarItems = toolbar_items_1.getToolbars(page);
  13881. if (extraToolbarItems) {
  13882. toolbarItems.push.apply(toolbarItems, extraToolbarItems);
  13883. }
  13884. _this.toolbarItems = toolbarItems;
  13885. if (onChange) {
  13886. _this.onChange = onChange;
  13887. }
  13888. if (allowKeyboard && _this.page && _this.page.mode === 'master') {
  13889. _this.listener = new fc_hotkeys_1.HotkeysListener();
  13890. _this.listener.on(fc_hotkeys_1.KEY_ALL, debounce(_this.onKeyboard, 150));
  13891. }
  13892. if (mountContainer) {
  13893. _this.mountContainer = mountContainer;
  13894. }
  13895. return _this;
  13896. }
  13897. Object.defineProperty(Drawboard.prototype, "markerMap", {
  13898. get: function () {
  13899. var map = {};
  13900. this.markers.forEach(function (marker) {
  13901. map[marker.id] = marker;
  13902. });
  13903. return map;
  13904. },
  13905. enumerable: true,
  13906. configurable: true
  13907. });
  13908. return Drawboard;
  13909. }(index_1.Baseboard);
  13910. exports.Drawboard = Drawboard;
  13911. /***/ }),
  13912. /***/ "./src/event/EventHub.ts":
  13913. /*!*******************************!*\
  13914. !*** ./src/event/EventHub.ts ***!
  13915. \*******************************/
  13916. /*! no static exports found */
  13917. /***/ (function(module, exports, __webpack_require__) {
  13918. "use strict";
  13919. var __extends = this && this.__extends || function () {
  13920. var extendStatics = function (d, b) {
  13921. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13922. d.__proto__ = b;
  13923. } || function (d, b) {
  13924. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13925. };
  13926. return extendStatics(d, b);
  13927. };
  13928. return function (d, b) {
  13929. extendStatics(d, b);
  13930. function __() {
  13931. this.constructor = d;
  13932. }
  13933. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13934. };
  13935. }();
  13936. Object.defineProperty(exports, "__esModule", { value: true });
  13937. var EventEmitter = __webpack_require__(/*! eventemitter3 */ "./node_modules/eventemitter3/index.js");
  13938. var EventHub = function (_super) {
  13939. __extends(EventHub, _super);
  13940. function EventHub() {
  13941. return _super !== null && _super.apply(this, arguments) || this;
  13942. }
  13943. return EventHub;
  13944. }(EventEmitter);
  13945. exports.EventHub = EventHub;
  13946. /***/ }),
  13947. /***/ "./src/index.ts":
  13948. /*!**********************!*\
  13949. !*** ./src/index.ts ***!
  13950. \**********************/
  13951. /*! no static exports found */
  13952. /***/ (function(module, exports, __webpack_require__) {
  13953. "use strict";
  13954. Object.defineProperty(exports, "__esModule", { value: true });
  13955. var Drawboard_1 = __webpack_require__(/*! ./drawboard/Drawboard */ "./src/drawboard/Drawboard/index.ts");
  13956. exports.Drawboard = Drawboard_1.Drawboard;
  13957. var toolbar_items_1 = __webpack_require__(/*! ./toolbar/toolbar-items */ "./src/toolbar/toolbar-items.ts");
  13958. exports.separatorToolbarItem = toolbar_items_1.separatorToolbarItem;
  13959. exports.closeToolbarItem = toolbar_items_1.closeToolbarItem;
  13960. var EventHub_1 = __webpack_require__(/*! ./event/EventHub */ "./src/event/EventHub.ts");
  13961. exports.EventHub = EventHub_1.EventHub;
  13962. var Whiteboard_1 = __webpack_require__(/*! ./whiteboard/Whiteboard */ "./src/whiteboard/Whiteboard/index.ts");
  13963. exports.Whiteboard = Whiteboard_1.Whiteboard;
  13964. var MirrorWhiteboard_1 = __webpack_require__(/*! ./whiteboard/MirrorWhiteboard */ "./src/whiteboard/MirrorWhiteboard/index.ts");
  13965. exports.MirrorWhiteboard = MirrorWhiteboard_1.MirrorWhiteboard;
  13966. var ReplayWhiteboard_1 = __webpack_require__(/*! ./whiteboard/ReplayWhiteboard */ "./src/whiteboard/ReplayWhiteboard/index.ts");
  13967. exports.ReplayWhiteboard = ReplayWhiteboard_1.ReplayWhiteboard;
  13968. /***/ }),
  13969. /***/ "./src/markers/ArrowMarker/index.ts":
  13970. /*!******************************************!*\
  13971. !*** ./src/markers/ArrowMarker/index.ts ***!
  13972. \******************************************/
  13973. /*! no static exports found */
  13974. /***/ (function(module, exports, __webpack_require__) {
  13975. "use strict";
  13976. var __extends = this && this.__extends || function () {
  13977. var extendStatics = function (d, b) {
  13978. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  13979. d.__proto__ = b;
  13980. } || function (d, b) {
  13981. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  13982. };
  13983. return extendStatics(d, b);
  13984. };
  13985. return function (d, b) {
  13986. extendStatics(d, b);
  13987. function __() {
  13988. this.constructor = d;
  13989. }
  13990. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  13991. };
  13992. }();
  13993. Object.defineProperty(exports, "__esModule", { value: true });
  13994. var LinearMarker_1 = __webpack_require__(/*! ../LinearMarker */ "./src/markers/LinearMarker/index.ts");
  13995. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  13996. var ArrowMarker = function (_super) {
  13997. __extends(ArrowMarker, _super);
  13998. function ArrowMarker() {
  13999. var _this = _super !== null && _super.apply(this, arguments) || this;
  14000. _this.type = 'arrow';
  14001. _this.ARROW_SIZE = 6;
  14002. return _this;
  14003. }
  14004. ArrowMarker.prototype.init = function () {
  14005. _super.prototype.init.call(this);
  14006. SvgHelper_1.SvgHelper.setAttributes(this.visual, [['class', 'arrow-marker']]);
  14007. var tip = SvgHelper_1.SvgHelper.createPolygon("0,0 " + this.ARROW_SIZE + "," + this.ARROW_SIZE / 2 + " 0," + this.ARROW_SIZE, [['class', 'arrow-marker-tip']]);
  14008. this.defs.push(SvgHelper_1.SvgHelper.createMarker('arrow-marker-head', 'auto', this.ARROW_SIZE, this.ARROW_SIZE, this.ARROW_SIZE - 1, this.ARROW_SIZE / 2, tip));
  14009. this.markerLine.setAttribute('marker-end', 'url(#arrow-marker-head');
  14010. };
  14011. ArrowMarker.createMarker = function (page) {
  14012. var marker = new ArrowMarker();
  14013. marker.page = page;
  14014. marker.init();
  14015. return marker;
  14016. };
  14017. return ArrowMarker;
  14018. }(LinearMarker_1.LinearMarker);
  14019. exports.ArrowMarker = ArrowMarker;
  14020. /***/ }),
  14021. /***/ "./src/markers/BaseMarker/ResizeGrip.ts":
  14022. /*!**********************************************!*\
  14023. !*** ./src/markers/BaseMarker/ResizeGrip.ts ***!
  14024. \**********************************************/
  14025. /*! no static exports found */
  14026. /***/ (function(module, exports, __webpack_require__) {
  14027. "use strict";
  14028. Object.defineProperty(exports, "__esModule", { value: true });
  14029. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14030. var ResizeGrip = function () {
  14031. function ResizeGrip() {
  14032. this.GRIP_SIZE = 10;
  14033. this.visual = SvgHelper_1.SvgHelper.createCircle(this.GRIP_SIZE, [['class', 'fc-whiteboard-control-grip']]);
  14034. }
  14035. return ResizeGrip;
  14036. }();
  14037. exports.ResizeGrip = ResizeGrip;
  14038. /***/ }),
  14039. /***/ "./src/markers/BaseMarker/index.ts":
  14040. /*!*****************************************!*\
  14041. !*** ./src/markers/BaseMarker/index.ts ***!
  14042. \*****************************************/
  14043. /*! no static exports found */
  14044. /***/ (function(module, exports, __webpack_require__) {
  14045. "use strict";
  14046. var __extends = this && this.__extends || function () {
  14047. var extendStatics = function (d, b) {
  14048. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14049. d.__proto__ = b;
  14050. } || function (d, b) {
  14051. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14052. };
  14053. return extendStatics(d, b);
  14054. };
  14055. return function (d, b) {
  14056. extendStatics(d, b);
  14057. function __() {
  14058. this.constructor = d;
  14059. }
  14060. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14061. };
  14062. }();
  14063. Object.defineProperty(exports, "__esModule", { value: true });
  14064. var uuid = __webpack_require__(/*! uuid/v1 */ "./node_modules/uuid/v1.js");
  14065. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14066. var index_1 = __webpack_require__(/*! ../../renderer/DomEventAware/index */ "./src/renderer/DomEventAware/index.ts");
  14067. var types_1 = __webpack_require__(/*! ../../utils/types */ "./src/utils/types.ts");
  14068. var BaseMarker = function (_super) {
  14069. __extends(BaseMarker, _super);
  14070. function BaseMarker() {
  14071. var _this = _super !== null && _super.apply(this, arguments) || this;
  14072. _this.id = uuid();
  14073. _this.type = 'base';
  14074. _this.onChange = function () {};
  14075. _this.defs = [];
  14076. _this.width = 200;
  14077. _this.height = 50;
  14078. _this.isActive = true;
  14079. _this.isDragging = false;
  14080. _this.isResizing = false;
  14081. _this.manipulate = function (ev) {
  14082. var scale = _this.visual.getScreenCTM().a;
  14083. var dx = (ev.screenX - _this.previousMouseX) / scale;
  14084. var dy = (ev.screenY - _this.previousMouseY) / scale;
  14085. if (_this.isDragging) {
  14086. _this.move(dx, dy);
  14087. }
  14088. if (_this.isResizing) {
  14089. _this.resize(dx, dy, function (pos) {
  14090. _this.onChange({
  14091. target: 'marker',
  14092. id: _this.id,
  14093. event: 'resizeMarker',
  14094. marker: { dx: dx, dy: dy, pos: pos }
  14095. });
  14096. });
  14097. }
  14098. _this.previousMouseX = ev.screenX;
  14099. _this.previousMouseY = ev.screenY;
  14100. };
  14101. _this.move = function (dx, dy) {
  14102. var translate = _this.visual.transform.baseVal.getItem(0);
  14103. translate.setMatrix(translate.matrix.translate(dx, dy));
  14104. _this.visual.transform.baseVal.replaceItem(translate, 0);
  14105. _this.x += dx;
  14106. _this.y += dy;
  14107. _this.onChange({ target: 'marker', id: _this.id, event: 'moveMarker', marker: { dx: dx, dy: dy } });
  14108. };
  14109. _this.moveTo = function (x, y) {
  14110. var translate = _this.visual.transform.baseVal.getItem(0);
  14111. translate.setMatrix(translate.matrix.translate(x - _this.x, y - _this.y));
  14112. _this.visual.transform.baseVal.replaceItem(translate, 0);
  14113. _this.x = x;
  14114. _this.y = y;
  14115. };
  14116. _this.addToVisual = function (el) {
  14117. _this.visual.appendChild(el);
  14118. };
  14119. _this.addToRenderVisual = function (el) {
  14120. _this.renderVisual.appendChild(el);
  14121. };
  14122. _this.onMouseDown = function (ev) {
  14123. ev.stopPropagation();
  14124. if (_this.page && _this.page.mode === 'mirror') {
  14125. return;
  14126. }
  14127. _this.select();
  14128. _this.isDragging = true;
  14129. _this.previousMouseX = ev.screenX;
  14130. _this.previousMouseY = ev.screenY;
  14131. };
  14132. _this.onMouseUp = function (ev) {
  14133. ev.stopPropagation();
  14134. _this.endManipulation();
  14135. };
  14136. _this.onMouseMove = function (ev) {
  14137. ev.stopPropagation();
  14138. _this.manipulate(ev);
  14139. };
  14140. return _this;
  14141. }
  14142. BaseMarker.prototype.reactToManipulation = function (type, _a) {
  14143. var _b = _a === void 0 ? {} : _a,
  14144. dx = _b.dx,
  14145. dy = _b.dy,
  14146. pos = _b.pos;
  14147. if (type === 'moveMarker') {
  14148. if (types_1.isNil(dx) || types_1.isNil(dy)) {
  14149. return;
  14150. }
  14151. this.move(dx, dy);
  14152. }
  14153. if (type === 'resizeMarker') {
  14154. if (types_1.isNil(dx) || types_1.isNil(dy)) {
  14155. return;
  14156. }
  14157. this.resizeByEvent(dx, dy, pos);
  14158. }
  14159. };
  14160. BaseMarker.prototype.endManipulation = function () {
  14161. this.isDragging = false;
  14162. this.isResizing = false;
  14163. };
  14164. BaseMarker.prototype.select = function () {
  14165. this.isActive = true;
  14166. if (this.onSelected) {
  14167. this.onSelected(this);
  14168. }
  14169. return;
  14170. };
  14171. BaseMarker.prototype.deselect = function () {
  14172. this.isActive = false;
  14173. this.endManipulation();
  14174. return;
  14175. };
  14176. BaseMarker.prototype.captureSnap = function () {
  14177. return {
  14178. id: this.id,
  14179. type: this.type,
  14180. isActive: this.isActive,
  14181. x: this.x,
  14182. y: this.y
  14183. };
  14184. };
  14185. BaseMarker.prototype.applySnap = function (snap) {
  14186. this.id = snap.id;
  14187. this.type = snap.type;
  14188. if (snap.x && snap.y) {
  14189. this.moveTo(snap.x, snap.y);
  14190. }
  14191. if (this.isActive) {
  14192. this.select();
  14193. }
  14194. };
  14195. BaseMarker.prototype.destroy = function () {
  14196. this.visual.style.display = 'none';
  14197. };
  14198. BaseMarker.prototype.resize = function (x, y, cb) {
  14199. return;
  14200. };
  14201. BaseMarker.prototype.resizeByEvent = function (x, y, pos) {
  14202. return;
  14203. };
  14204. BaseMarker.prototype.init = function () {
  14205. this.visual = SvgHelper_1.SvgHelper.createGroup();
  14206. this.visual.transform.baseVal.appendItem(SvgHelper_1.SvgHelper.createTransform());
  14207. _super.prototype.init.call(this, this.visual);
  14208. this.renderVisual = SvgHelper_1.SvgHelper.createGroup([['class', 'render-visual']]);
  14209. this.visual.appendChild(this.renderVisual);
  14210. };
  14211. BaseMarker.createMarker = function (page) {
  14212. var marker = new BaseMarker();
  14213. marker.page = page;
  14214. marker.init();
  14215. return marker;
  14216. };
  14217. return BaseMarker;
  14218. }(index_1.DomEventAware);
  14219. exports.BaseMarker = BaseMarker;
  14220. /***/ }),
  14221. /***/ "./src/markers/CoverMarker/index.ts":
  14222. /*!******************************************!*\
  14223. !*** ./src/markers/CoverMarker/index.ts ***!
  14224. \******************************************/
  14225. /*! no static exports found */
  14226. /***/ (function(module, exports, __webpack_require__) {
  14227. "use strict";
  14228. var __extends = this && this.__extends || function () {
  14229. var extendStatics = function (d, b) {
  14230. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14231. d.__proto__ = b;
  14232. } || function (d, b) {
  14233. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14234. };
  14235. return extendStatics(d, b);
  14236. };
  14237. return function (d, b) {
  14238. extendStatics(d, b);
  14239. function __() {
  14240. this.constructor = d;
  14241. }
  14242. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14243. };
  14244. }();
  14245. Object.defineProperty(exports, "__esModule", { value: true });
  14246. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14247. var RectBaseMarker_1 = __webpack_require__(/*! ../RectMarker/RectBaseMarker */ "./src/markers/RectMarker/RectBaseMarker.ts");
  14248. var CoverMarker = function (_super) {
  14249. __extends(CoverMarker, _super);
  14250. function CoverMarker() {
  14251. var _this = _super !== null && _super.apply(this, arguments) || this;
  14252. _this.type = 'cover';
  14253. return _this;
  14254. }
  14255. CoverMarker.prototype.init = function () {
  14256. _super.prototype.init.call(this);
  14257. SvgHelper_1.SvgHelper.setAttributes(this.visual, [['class', 'cover-marker']]);
  14258. };
  14259. CoverMarker.createMarker = function (page) {
  14260. var marker = new CoverMarker();
  14261. marker.page = page;
  14262. marker.init();
  14263. return marker;
  14264. };
  14265. return CoverMarker;
  14266. }(RectBaseMarker_1.RectBaseMarker);
  14267. exports.CoverMarker = CoverMarker;
  14268. /***/ }),
  14269. /***/ "./src/markers/HighlightMarker/index.ts":
  14270. /*!**********************************************!*\
  14271. !*** ./src/markers/HighlightMarker/index.ts ***!
  14272. \**********************************************/
  14273. /*! no static exports found */
  14274. /***/ (function(module, exports, __webpack_require__) {
  14275. "use strict";
  14276. var __extends = this && this.__extends || function () {
  14277. var extendStatics = function (d, b) {
  14278. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14279. d.__proto__ = b;
  14280. } || function (d, b) {
  14281. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14282. };
  14283. return extendStatics(d, b);
  14284. };
  14285. return function (d, b) {
  14286. extendStatics(d, b);
  14287. function __() {
  14288. this.constructor = d;
  14289. }
  14290. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14291. };
  14292. }();
  14293. Object.defineProperty(exports, "__esModule", { value: true });
  14294. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14295. var RectBaseMarker_1 = __webpack_require__(/*! ../RectMarker/RectBaseMarker */ "./src/markers/RectMarker/RectBaseMarker.ts");
  14296. var HighlightMarker = function (_super) {
  14297. __extends(HighlightMarker, _super);
  14298. function HighlightMarker() {
  14299. var _this = _super !== null && _super.apply(this, arguments) || this;
  14300. _this.type = 'highlight';
  14301. return _this;
  14302. }
  14303. HighlightMarker.prototype.init = function () {
  14304. _super.prototype.init.call(this);
  14305. SvgHelper_1.SvgHelper.setAttributes(this.visual, [['class', 'highlight-marker']]);
  14306. };
  14307. HighlightMarker.createMarker = function (page) {
  14308. var marker = new HighlightMarker();
  14309. marker.page = page;
  14310. marker.init();
  14311. return marker;
  14312. };
  14313. return HighlightMarker;
  14314. }(RectBaseMarker_1.RectBaseMarker);
  14315. exports.HighlightMarker = HighlightMarker;
  14316. /***/ }),
  14317. /***/ "./src/markers/LineMarker/index.ts":
  14318. /*!*****************************************!*\
  14319. !*** ./src/markers/LineMarker/index.ts ***!
  14320. \*****************************************/
  14321. /*! no static exports found */
  14322. /***/ (function(module, exports, __webpack_require__) {
  14323. "use strict";
  14324. var __extends = this && this.__extends || function () {
  14325. var extendStatics = function (d, b) {
  14326. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14327. d.__proto__ = b;
  14328. } || function (d, b) {
  14329. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14330. };
  14331. return extendStatics(d, b);
  14332. };
  14333. return function (d, b) {
  14334. extendStatics(d, b);
  14335. function __() {
  14336. this.constructor = d;
  14337. }
  14338. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14339. };
  14340. }();
  14341. Object.defineProperty(exports, "__esModule", { value: true });
  14342. var LinearMarker_1 = __webpack_require__(/*! ../LinearMarker */ "./src/markers/LinearMarker/index.ts");
  14343. var index_1 = __webpack_require__(/*! ./../../renderer/SvgHelper/index */ "./src/renderer/SvgHelper/index.ts");
  14344. var LineMarker = function (_super) {
  14345. __extends(LineMarker, _super);
  14346. function LineMarker() {
  14347. var _this = _super !== null && _super.apply(this, arguments) || this;
  14348. _this.type = 'line';
  14349. return _this;
  14350. }
  14351. LineMarker.prototype.init = function () {
  14352. _super.prototype.init.call(this);
  14353. index_1.SvgHelper.setAttributes(this.visual, [['class', 'line-marker']]);
  14354. };
  14355. LineMarker.createMarker = function (page) {
  14356. var marker = new LineMarker();
  14357. marker.page = page;
  14358. marker.init();
  14359. return marker;
  14360. };
  14361. return LineMarker;
  14362. }(LinearMarker_1.LinearMarker);
  14363. exports.LineMarker = LineMarker;
  14364. /***/ }),
  14365. /***/ "./src/markers/LinearMarker/index.ts":
  14366. /*!*******************************************!*\
  14367. !*** ./src/markers/LinearMarker/index.ts ***!
  14368. \*******************************************/
  14369. /*! no static exports found */
  14370. /***/ (function(module, exports, __webpack_require__) {
  14371. "use strict";
  14372. var __extends = this && this.__extends || function () {
  14373. var extendStatics = function (d, b) {
  14374. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14375. d.__proto__ = b;
  14376. } || function (d, b) {
  14377. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14378. };
  14379. return extendStatics(d, b);
  14380. };
  14381. return function (d, b) {
  14382. extendStatics(d, b);
  14383. function __() {
  14384. this.constructor = d;
  14385. }
  14386. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14387. };
  14388. }();
  14389. Object.defineProperty(exports, "__esModule", { value: true });
  14390. var BaseMarker_1 = __webpack_require__(/*! ../BaseMarker */ "./src/markers/BaseMarker/index.ts");
  14391. var ResizeGrip_1 = __webpack_require__(/*! ../BaseMarker/ResizeGrip */ "./src/markers/BaseMarker/ResizeGrip.ts");
  14392. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14393. var LinearMarker = function (_super) {
  14394. __extends(LinearMarker, _super);
  14395. function LinearMarker() {
  14396. var _this = _super !== null && _super.apply(this, arguments) || this;
  14397. _this.MIN_LENGTH = 20;
  14398. _this.x1 = 0;
  14399. _this.y1 = 0;
  14400. _this.x2 = _this.width;
  14401. _this.y2 = 0;
  14402. _this.getLineLength = function (x1, y1, x2, y2) {
  14403. var dx = Math.abs(x1 - x2);
  14404. var dy = Math.abs(y1 - y2);
  14405. return Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
  14406. };
  14407. _this.addControlBox = function () {
  14408. _this.controlBox = SvgHelper_1.SvgHelper.createGroup([['class', 'fc-whiteboard-line-control-box']]);
  14409. _this.addToVisual(_this.controlBox);
  14410. _this.addControlGrips();
  14411. };
  14412. _this.adjustControlBox = function () {
  14413. _this.positionGrips();
  14414. };
  14415. _this.addControlGrips = function () {
  14416. _this.controlGrips = {
  14417. left: _this.createGrip(),
  14418. right: _this.createGrip()
  14419. };
  14420. _this.positionGrips();
  14421. };
  14422. _this.createGrip = function () {
  14423. var grip = new ResizeGrip_1.ResizeGrip();
  14424. grip.visual.transform.baseVal.appendItem(SvgHelper_1.SvgHelper.createTransform());
  14425. _this.controlBox.appendChild(grip.visual);
  14426. grip.visual.addEventListener('mousedown', _this.gripMouseDown);
  14427. grip.visual.addEventListener('mousemove', _this.gripMouseMove);
  14428. grip.visual.addEventListener('mouseup', _this.gripMouseUp);
  14429. grip.visual.addEventListener('touchstart', _this.onTouch, { passive: false });
  14430. grip.visual.addEventListener('touchend', _this.onTouch, { passive: false });
  14431. grip.visual.addEventListener('touchmove', _this.onTouch, { passive: false });
  14432. if (_this.page && _this.page.mode === 'mirror') {
  14433. grip.visual.style.visibility = 'hidden';
  14434. }
  14435. return grip;
  14436. };
  14437. _this.gripMouseDown = function (ev) {
  14438. _this.isResizing = true;
  14439. _this.activeGrip = ev.target === _this.controlGrips.left.visual ? _this.controlGrips.left : _this.controlGrips.right;
  14440. _this.previousMouseX = ev.screenX;
  14441. _this.previousMouseY = ev.screenY;
  14442. ev.stopPropagation();
  14443. };
  14444. _this.gripMouseUp = function (ev) {
  14445. _this.isResizing = false;
  14446. _this.activeGrip = null;
  14447. ev.stopPropagation();
  14448. };
  14449. _this.gripMouseMove = function (ev) {
  14450. if (_this.isResizing) {
  14451. _this.resize(ev.movementX, ev.movementY);
  14452. }
  14453. };
  14454. _this.positionLine = function (bound) {
  14455. _this.x1 = bound.x1;
  14456. _this.y1 = bound.y1;
  14457. _this.x2 = bound.x2;
  14458. _this.y2 = bound.y2;
  14459. _this.markerBgLine.setAttribute('x1', _this.x1.toString());
  14460. _this.markerBgLine.setAttribute('y1', _this.y1.toString());
  14461. _this.markerLine.setAttribute('x2', _this.x2.toString());
  14462. _this.markerLine.setAttribute('y2', _this.y2.toString());
  14463. };
  14464. _this.positionGrips = function () {
  14465. var gripSize = _this.controlGrips.left.GRIP_SIZE;
  14466. var x1 = _this.x1 - gripSize / 2;
  14467. var y1 = _this.y1 - gripSize / 2;
  14468. var x2 = _this.x2 - gripSize / 2;
  14469. var y2 = _this.y2 - gripSize / 2;
  14470. _this.positionGrip(_this.controlGrips.left.visual, x1, y1);
  14471. _this.positionGrip(_this.controlGrips.right.visual, x2, y2);
  14472. };
  14473. _this.positionGrip = function (grip, x, y) {
  14474. var translate = grip.transform.baseVal.getItem(0);
  14475. translate.setTranslate(x, y);
  14476. grip.transform.baseVal.replaceItem(translate, 0);
  14477. };
  14478. return _this;
  14479. }
  14480. LinearMarker.prototype.captureSnap = function () {
  14481. var baseSnap = _super.prototype.captureSnap.call(this);
  14482. baseSnap.linearSnap = {
  14483. x1: this.x1,
  14484. y1: this.y1,
  14485. x2: this.x2,
  14486. y2: this.y2
  14487. };
  14488. return baseSnap;
  14489. };
  14490. LinearMarker.prototype.applySnap = function (snap) {
  14491. _super.prototype.applySnap.call(this, snap);
  14492. if (snap.linearSnap) {
  14493. this.positionLine(snap.linearSnap);
  14494. }
  14495. };
  14496. LinearMarker.prototype.endManipulation = function () {
  14497. _super.prototype.endManipulation.call(this);
  14498. this.isResizing = false;
  14499. this.activeGrip = null;
  14500. };
  14501. LinearMarker.prototype.select = function () {
  14502. _super.prototype.select.call(this);
  14503. this.controlBox.style.display = '';
  14504. };
  14505. LinearMarker.prototype.deselect = function () {
  14506. _super.prototype.deselect.call(this);
  14507. this.controlBox.style.display = 'none';
  14508. };
  14509. LinearMarker.prototype.init = function () {
  14510. _super.prototype.init.call(this);
  14511. this.markerBgLine = SvgHelper_1.SvgHelper.createLine(0, 0, this.x2, 0, [['stroke', 'transparent'], ['stroke-width', '30']]);
  14512. this.addToRenderVisual(this.markerBgLine);
  14513. this.markerLine = SvgHelper_1.SvgHelper.createLine(0, 0, this.x2, 0);
  14514. this.addToRenderVisual(this.markerLine);
  14515. this.addControlBox();
  14516. if (this.page && this.page.mode === 'mirror') {
  14517. this.controlBox.style.display = 'none';
  14518. }
  14519. };
  14520. LinearMarker.prototype.resize = function (x, y, onPosition) {
  14521. if (this.activeGrip) {
  14522. if (this.activeGrip === this.controlGrips.left && this.getLineLength(this.x1 + x, this.y1 + 1, this.x2, this.y2) >= this.MIN_LENGTH) {
  14523. this.x1 += x;
  14524. this.y1 += y;
  14525. this.markerBgLine.setAttribute('x1', this.x1.toString());
  14526. this.markerBgLine.setAttribute('y1', this.y1.toString());
  14527. this.markerLine.setAttribute('x1', this.x1.toString());
  14528. this.markerLine.setAttribute('y1', this.y1.toString());
  14529. if (onPosition) {
  14530. onPosition('left');
  14531. }
  14532. } else if (this.activeGrip === this.controlGrips.right && this.getLineLength(this.x1, this.y1, this.x2 + x, this.y2 + y) >= this.MIN_LENGTH) {
  14533. this.x2 += x;
  14534. this.y2 += y;
  14535. this.markerBgLine.setAttribute('x2', this.x2.toString());
  14536. this.markerBgLine.setAttribute('y2', this.y2.toString());
  14537. this.markerLine.setAttribute('x2', this.x2.toString());
  14538. this.markerLine.setAttribute('y2', this.y2.toString());
  14539. if (onPosition) {
  14540. onPosition('right');
  14541. }
  14542. }
  14543. }
  14544. this.adjustControlBox();
  14545. };
  14546. LinearMarker.prototype.resizeByEvent = function (x, y, pos) {
  14547. if (pos === 'left') {
  14548. this.activeGrip = this.controlGrips.left;
  14549. } else {
  14550. this.activeGrip = this.controlGrips.right;
  14551. }
  14552. this.resize(x, y);
  14553. };
  14554. LinearMarker.createMarker = function (page) {
  14555. var marker = new LinearMarker();
  14556. marker.page = page;
  14557. marker.init();
  14558. return marker;
  14559. };
  14560. return LinearMarker;
  14561. }(BaseMarker_1.BaseMarker);
  14562. exports.LinearMarker = LinearMarker;
  14563. /***/ }),
  14564. /***/ "./src/markers/RectMarker/RectBaseMarker.ts":
  14565. /*!**************************************************!*\
  14566. !*** ./src/markers/RectMarker/RectBaseMarker.ts ***!
  14567. \**************************************************/
  14568. /*! no static exports found */
  14569. /***/ (function(module, exports, __webpack_require__) {
  14570. "use strict";
  14571. var __extends = this && this.__extends || function () {
  14572. var extendStatics = function (d, b) {
  14573. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14574. d.__proto__ = b;
  14575. } || function (d, b) {
  14576. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14577. };
  14578. return extendStatics(d, b);
  14579. };
  14580. return function (d, b) {
  14581. extendStatics(d, b);
  14582. function __() {
  14583. this.constructor = d;
  14584. }
  14585. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14586. };
  14587. }();
  14588. Object.defineProperty(exports, "__esModule", { value: true });
  14589. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14590. var RectangularMarker_1 = __webpack_require__(/*! ../RectangularMarker */ "./src/markers/RectangularMarker/index.ts");
  14591. var RectBaseMarker = function (_super) {
  14592. __extends(RectBaseMarker, _super);
  14593. function RectBaseMarker() {
  14594. return _super !== null && _super.apply(this, arguments) || this;
  14595. }
  14596. RectBaseMarker.prototype.applySnap = function (snap) {
  14597. _super.prototype.applySnap.call(this, snap);
  14598. if (snap.rectSnap) {
  14599. this.markerRect.setAttribute('width', this.width.toString());
  14600. this.markerRect.setAttribute('height', this.height.toString());
  14601. }
  14602. };
  14603. RectBaseMarker.prototype.init = function () {
  14604. _super.prototype.init.call(this);
  14605. this.markerRect = SvgHelper_1.SvgHelper.createRect(this.width, this.height);
  14606. this.addToRenderVisual(this.markerRect);
  14607. };
  14608. RectBaseMarker.prototype.resize = function (x, y, onPosition) {
  14609. _super.prototype.resize.call(this, x, y, onPosition);
  14610. this.markerRect.setAttribute('width', this.width.toString());
  14611. this.markerRect.setAttribute('height', this.height.toString());
  14612. };
  14613. RectBaseMarker.createMarker = function (page) {
  14614. var marker = new RectBaseMarker();
  14615. marker.page = page;
  14616. marker.init();
  14617. return marker;
  14618. };
  14619. return RectBaseMarker;
  14620. }(RectangularMarker_1.RectangularMarker);
  14621. exports.RectBaseMarker = RectBaseMarker;
  14622. /***/ }),
  14623. /***/ "./src/markers/RectMarker/index.ts":
  14624. /*!*****************************************!*\
  14625. !*** ./src/markers/RectMarker/index.ts ***!
  14626. \*****************************************/
  14627. /*! no static exports found */
  14628. /***/ (function(module, exports, __webpack_require__) {
  14629. "use strict";
  14630. var __extends = this && this.__extends || function () {
  14631. var extendStatics = function (d, b) {
  14632. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14633. d.__proto__ = b;
  14634. } || function (d, b) {
  14635. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14636. };
  14637. return extendStatics(d, b);
  14638. };
  14639. return function (d, b) {
  14640. extendStatics(d, b);
  14641. function __() {
  14642. this.constructor = d;
  14643. }
  14644. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14645. };
  14646. }();
  14647. Object.defineProperty(exports, "__esModule", { value: true });
  14648. var RectBaseMarker_1 = __webpack_require__(/*! ./RectBaseMarker */ "./src/markers/RectMarker/RectBaseMarker.ts");
  14649. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14650. var RectMarker = function (_super) {
  14651. __extends(RectMarker, _super);
  14652. function RectMarker() {
  14653. var _this = _super !== null && _super.apply(this, arguments) || this;
  14654. _this.type = 'rect';
  14655. return _this;
  14656. }
  14657. RectMarker.prototype.init = function () {
  14658. _super.prototype.init.call(this);
  14659. SvgHelper_1.SvgHelper.setAttributes(this.visual, [['class', 'rect-marker']]);
  14660. };
  14661. RectMarker.createMarker = function (page) {
  14662. var marker = new RectMarker();
  14663. marker.page = page;
  14664. marker.init();
  14665. return marker;
  14666. };
  14667. return RectMarker;
  14668. }(RectBaseMarker_1.RectBaseMarker);
  14669. exports.RectMarker = RectMarker;
  14670. /***/ }),
  14671. /***/ "./src/markers/RectangularMarker/RectangularMarkerGrips.ts":
  14672. /*!*****************************************************************!*\
  14673. !*** ./src/markers/RectangularMarker/RectangularMarkerGrips.ts ***!
  14674. \*****************************************************************/
  14675. /*! no static exports found */
  14676. /***/ (function(module, exports, __webpack_require__) {
  14677. "use strict";
  14678. Object.defineProperty(exports, "__esModule", { value: true });
  14679. var RectangularMarkerGrips = function () {
  14680. function RectangularMarkerGrips() {
  14681. var _this = this;
  14682. this.findGripByVisual = function (gripVisual) {
  14683. switch (gripVisual) {
  14684. case _this.topLeft.visual:
  14685. return _this.topLeft;
  14686. case _this.topCenter.visual:
  14687. return _this.topCenter;
  14688. case _this.topRight.visual:
  14689. return _this.topRight;
  14690. case _this.centerLeft.visual:
  14691. return _this.centerLeft;
  14692. case _this.centerRight.visual:
  14693. return _this.centerRight;
  14694. case _this.bottomLeft.visual:
  14695. return _this.bottomLeft;
  14696. case _this.bottomCenter.visual:
  14697. return _this.bottomCenter;
  14698. case _this.bottomRight.visual:
  14699. return _this.bottomRight;
  14700. default:
  14701. return _this.topLeft;
  14702. }
  14703. };
  14704. }
  14705. return RectangularMarkerGrips;
  14706. }();
  14707. exports.RectangularMarkerGrips = RectangularMarkerGrips;
  14708. /***/ }),
  14709. /***/ "./src/markers/RectangularMarker/index.ts":
  14710. /*!************************************************!*\
  14711. !*** ./src/markers/RectangularMarker/index.ts ***!
  14712. \************************************************/
  14713. /*! no static exports found */
  14714. /***/ (function(module, exports, __webpack_require__) {
  14715. "use strict";
  14716. var __extends = this && this.__extends || function () {
  14717. var extendStatics = function (d, b) {
  14718. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14719. d.__proto__ = b;
  14720. } || function (d, b) {
  14721. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14722. };
  14723. return extendStatics(d, b);
  14724. };
  14725. return function (d, b) {
  14726. extendStatics(d, b);
  14727. function __() {
  14728. this.constructor = d;
  14729. }
  14730. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14731. };
  14732. }();
  14733. Object.defineProperty(exports, "__esModule", { value: true });
  14734. var RectangularMarkerGrips_1 = __webpack_require__(/*! ./RectangularMarkerGrips */ "./src/markers/RectangularMarker/RectangularMarkerGrips.ts");
  14735. var BaseMarker_1 = __webpack_require__(/*! ../BaseMarker */ "./src/markers/BaseMarker/index.ts");
  14736. var ResizeGrip_1 = __webpack_require__(/*! ../BaseMarker/ResizeGrip */ "./src/markers/BaseMarker/ResizeGrip.ts");
  14737. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  14738. var RectangularMarker = function (_super) {
  14739. __extends(RectangularMarker, _super);
  14740. function RectangularMarker() {
  14741. var _this = _super !== null && _super.apply(this, arguments) || this;
  14742. _this.MIN_SIZE = 5;
  14743. _this.CB_DISTANCE = 10;
  14744. _this.addControlBox = function () {
  14745. _this.controlBox = SvgHelper_1.SvgHelper.createGroup([['class', 'fc-whiteboard-rect-control-box']]);
  14746. var translate = SvgHelper_1.SvgHelper.createTransform();
  14747. translate.setTranslate(-_this.CB_DISTANCE / 2, -_this.CB_DISTANCE / 2);
  14748. _this.controlBox.transform.baseVal.appendItem(translate);
  14749. _this.addToVisual(_this.controlBox);
  14750. _this.controlRect = SvgHelper_1.SvgHelper.createRect(_this.width + _this.CB_DISTANCE, _this.height + _this.CB_DISTANCE, [['class', 'fc-whiteboard-rect-control-rect']]);
  14751. _this.controlBox.appendChild(_this.controlRect);
  14752. _this.controlGrips = new RectangularMarkerGrips_1.RectangularMarkerGrips();
  14753. _this.addControlGrips();
  14754. };
  14755. _this.adjustControlBox = function () {
  14756. _this.controlRect.setAttribute('width', (_this.width + _this.CB_DISTANCE).toString());
  14757. _this.controlRect.setAttribute('height', (_this.height + _this.CB_DISTANCE).toString());
  14758. _this.positionGrips();
  14759. };
  14760. _this.addControlGrips = function () {
  14761. _this.controlGrips.topLeft = _this.createGrip();
  14762. _this.controlGrips.topCenter = _this.createGrip();
  14763. _this.controlGrips.topRight = _this.createGrip();
  14764. _this.controlGrips.centerLeft = _this.createGrip();
  14765. _this.controlGrips.centerRight = _this.createGrip();
  14766. _this.controlGrips.bottomLeft = _this.createGrip();
  14767. _this.controlGrips.bottomCenter = _this.createGrip();
  14768. _this.controlGrips.bottomRight = _this.createGrip();
  14769. _this.positionGrips();
  14770. };
  14771. _this.createGrip = function () {
  14772. var grip = new ResizeGrip_1.ResizeGrip();
  14773. grip.visual.transform.baseVal.appendItem(SvgHelper_1.SvgHelper.createTransform());
  14774. _this.controlBox.appendChild(grip.visual);
  14775. grip.visual.addEventListener('mousedown', _this.gripMouseDown);
  14776. grip.visual.addEventListener('mousemove', _this.gripMouseMove);
  14777. grip.visual.addEventListener('mouseup', _this.gripMouseUp);
  14778. grip.visual.addEventListener('touchstart', _this.onTouch, { passive: false });
  14779. grip.visual.addEventListener('touchend', _this.onTouch, { passive: false });
  14780. grip.visual.addEventListener('touchmove', _this.onTouch, { passive: false });
  14781. return grip;
  14782. };
  14783. _this.gripMouseDown = function (ev) {
  14784. _this.isResizing = true;
  14785. _this.activeGrip = _this.controlGrips.findGripByVisual(ev.target) || null;
  14786. _this.previousMouseX = ev.screenX;
  14787. _this.previousMouseY = ev.screenY;
  14788. ev.stopPropagation();
  14789. };
  14790. _this.gripMouseUp = function (ev) {
  14791. _this.isResizing = false;
  14792. _this.activeGrip = null;
  14793. ev.stopPropagation();
  14794. };
  14795. _this.gripMouseMove = function (ev) {
  14796. if (_this.isResizing) {
  14797. _this.manipulate(ev);
  14798. }
  14799. };
  14800. _this.positionGrips = function () {
  14801. var gripSize = _this.controlGrips.topLeft.GRIP_SIZE;
  14802. var left = -gripSize / 2;
  14803. var top = left;
  14804. var cx = (_this.width + _this.CB_DISTANCE) / 2 - gripSize / 2;
  14805. var cy = (_this.height + _this.CB_DISTANCE) / 2 - gripSize / 2;
  14806. var bottom = _this.height + _this.CB_DISTANCE - gripSize / 2;
  14807. var right = _this.width + _this.CB_DISTANCE - gripSize / 2;
  14808. _this.positionGrip(_this.controlGrips.topLeft.visual, left, top);
  14809. _this.positionGrip(_this.controlGrips.topCenter.visual, cx, top);
  14810. _this.positionGrip(_this.controlGrips.topRight.visual, right, top);
  14811. _this.positionGrip(_this.controlGrips.centerLeft.visual, left, cy);
  14812. _this.positionGrip(_this.controlGrips.centerRight.visual, right, cy);
  14813. _this.positionGrip(_this.controlGrips.bottomLeft.visual, left, bottom);
  14814. _this.positionGrip(_this.controlGrips.bottomCenter.visual, cx, bottom);
  14815. _this.positionGrip(_this.controlGrips.bottomRight.visual, right, bottom);
  14816. };
  14817. _this.positionGrip = function (grip, x, y) {
  14818. var translate = grip.transform.baseVal.getItem(0);
  14819. translate.setTranslate(x, y);
  14820. grip.transform.baseVal.replaceItem(translate, 0);
  14821. };
  14822. return _this;
  14823. }
  14824. RectangularMarker.prototype.captureSnap = function () {
  14825. var snap = _super.prototype.captureSnap.call(this);
  14826. snap.rectSnap = {
  14827. width: this.width,
  14828. height: this.height
  14829. };
  14830. return snap;
  14831. };
  14832. RectangularMarker.prototype.applySnap = function (snap) {
  14833. _super.prototype.applySnap.call(this, snap);
  14834. if (snap.rectSnap) {
  14835. var _a = snap.rectSnap,
  14836. width = _a.width,
  14837. height = _a.height;
  14838. if (width && height) {
  14839. this.width = width;
  14840. this.height = height;
  14841. this.adjustControlBox();
  14842. }
  14843. }
  14844. };
  14845. RectangularMarker.prototype.endManipulation = function () {
  14846. _super.prototype.endManipulation.call(this);
  14847. this.isResizing = false;
  14848. this.activeGrip = null;
  14849. };
  14850. RectangularMarker.prototype.select = function () {
  14851. _super.prototype.select.call(this);
  14852. this.controlBox.style.display = '';
  14853. };
  14854. RectangularMarker.prototype.deselect = function () {
  14855. _super.prototype.deselect.call(this);
  14856. this.controlBox.style.display = 'none';
  14857. };
  14858. RectangularMarker.prototype.init = function () {
  14859. _super.prototype.init.call(this);
  14860. this.addControlBox();
  14861. if (this.page && this.page.mode === 'mirror') {
  14862. this.controlBox.style.display = 'none';
  14863. }
  14864. };
  14865. RectangularMarker.prototype.resizeByEvent = function (dx, dy, pos) {
  14866. this.activeGrip = this.controlGrips[pos];
  14867. this.resize(dx, dy);
  14868. };
  14869. RectangularMarker.prototype.resize = function (dx, dy, onPosition) {
  14870. var translateX = 0;
  14871. var translateY = 0;
  14872. switch (this.activeGrip) {
  14873. case this.controlGrips.topLeft:
  14874. this.width -= dx;
  14875. this.height -= dy;
  14876. translateX += dx;
  14877. translateY += dy;
  14878. this.x += dx;
  14879. this.y += dy;
  14880. if (onPosition) {
  14881. onPosition('topLeft');
  14882. }
  14883. break;
  14884. case this.controlGrips.bottomLeft:
  14885. this.width -= dx;
  14886. this.height += dy;
  14887. translateX += dx;
  14888. this.x += dx;
  14889. if (onPosition) {
  14890. onPosition('bottomLeft');
  14891. }
  14892. break;
  14893. case this.controlGrips.topRight:
  14894. this.width += dx;
  14895. this.height -= dy;
  14896. translateY += dy;
  14897. this.y += dy;
  14898. if (onPosition) {
  14899. onPosition('topRight');
  14900. }
  14901. break;
  14902. case this.controlGrips.bottomRight:
  14903. this.width += dx;
  14904. this.height += dy;
  14905. if (onPosition) {
  14906. onPosition('bottomRight');
  14907. }
  14908. break;
  14909. case this.controlGrips.centerLeft:
  14910. this.width -= dx;
  14911. translateX += dx;
  14912. this.x += dx;
  14913. if (onPosition) {
  14914. onPosition('centerLeft');
  14915. }
  14916. break;
  14917. case this.controlGrips.centerRight:
  14918. this.width += dx;
  14919. if (onPosition) {
  14920. onPosition('centerRight');
  14921. }
  14922. break;
  14923. case this.controlGrips.topCenter:
  14924. this.height -= dy;
  14925. translateY += dy;
  14926. this.y += dy;
  14927. if (onPosition) {
  14928. onPosition('topCenter');
  14929. }
  14930. break;
  14931. case this.controlGrips.bottomCenter:
  14932. this.height += dy;
  14933. if (onPosition) {
  14934. onPosition('bottomCenter');
  14935. }
  14936. break;
  14937. default:
  14938. break;
  14939. }
  14940. if (this.width < this.MIN_SIZE) {
  14941. var offset = this.MIN_SIZE - this.width;
  14942. this.width = this.MIN_SIZE;
  14943. if (translateX !== 0) {
  14944. translateX -= offset;
  14945. }
  14946. }
  14947. if (this.height < this.MIN_SIZE) {
  14948. var offset = this.MIN_SIZE - this.height;
  14949. this.height = this.MIN_SIZE;
  14950. if (translateY !== 0) {
  14951. translateY -= offset;
  14952. }
  14953. }
  14954. if (translateX !== 0 || translateY !== 0) {
  14955. var translate = this.visual.transform.baseVal.getItem(0);
  14956. translate.setMatrix(translate.matrix.translate(translateX, translateY));
  14957. this.visual.transform.baseVal.replaceItem(translate, 0);
  14958. }
  14959. this.adjustControlBox();
  14960. };
  14961. RectangularMarker.prototype.onTouch = function (ev) {
  14962. _super.prototype.onTouch.call(this, ev);
  14963. };
  14964. RectangularMarker.createMarker = function (page) {
  14965. var marker = new RectangularMarker();
  14966. marker.page = page;
  14967. marker.init();
  14968. return marker;
  14969. };
  14970. return RectangularMarker;
  14971. }(BaseMarker_1.BaseMarker);
  14972. exports.RectangularMarker = RectangularMarker;
  14973. /***/ }),
  14974. /***/ "./src/markers/TextMarker/index.ts":
  14975. /*!*****************************************!*\
  14976. !*** ./src/markers/TextMarker/index.ts ***!
  14977. \*****************************************/
  14978. /*! no static exports found */
  14979. /***/ (function(module, exports, __webpack_require__) {
  14980. "use strict";
  14981. var __extends = this && this.__extends || function () {
  14982. var extendStatics = function (d, b) {
  14983. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  14984. d.__proto__ = b;
  14985. } || function (d, b) {
  14986. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  14987. };
  14988. return extendStatics(d, b);
  14989. };
  14990. return function (d, b) {
  14991. extendStatics(d, b);
  14992. function __() {
  14993. this.constructor = d;
  14994. }
  14995. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  14996. };
  14997. }();
  14998. Object.defineProperty(exports, "__esModule", { value: true });
  14999. var RectangularMarker_1 = __webpack_require__(/*! ../RectangularMarker */ "./src/markers/RectangularMarker/index.ts");
  15000. var SvgHelper_1 = __webpack_require__(/*! ../../renderer/SvgHelper */ "./src/renderer/SvgHelper/index.ts");
  15001. var OkIcon = __webpack_require__(/*! ../../assets/check.svg */ "./src/assets/check.svg");
  15002. var CancelIcon = __webpack_require__(/*! ../../assets/times.svg */ "./src/assets/times.svg");
  15003. var TextMarker = function (_super) {
  15004. __extends(TextMarker, _super);
  15005. function TextMarker() {
  15006. var _this = _super !== null && _super.apply(this, arguments) || this;
  15007. _this.type = 'text';
  15008. _this.MIN_SIZE = 50;
  15009. _this.DEFAULT_TEXT = 'Double-click to edit text';
  15010. _this.text = _this.DEFAULT_TEXT;
  15011. _this.inDoubleTap = false;
  15012. _this.renderText = function () {
  15013. var LINE_SIZE = '1.2em';
  15014. while (_this.textElement.lastChild) {
  15015. _this.textElement.removeChild(_this.textElement.lastChild);
  15016. }
  15017. var lines = _this.text.split(/\r\n|[\n\v\f\r\x85\u2028\u2029]/);
  15018. for (var _i = 0, lines_1 = lines; _i < lines_1.length; _i++) {
  15019. var line = lines_1[_i];
  15020. if (line.trim() === '') {
  15021. line = ' ';
  15022. }
  15023. _this.textElement.appendChild(SvgHelper_1.SvgHelper.createTSpan(line, [['x', '0'], ['dy', LINE_SIZE]]));
  15024. }
  15025. setTimeout(_this.sizeText, 10);
  15026. };
  15027. _this.sizeText = function () {
  15028. var textSize = _this.textElement.getBBox();
  15029. var x = 0;
  15030. var y = 0;
  15031. var scale = 1.0;
  15032. if (textSize.width > 0 && textSize.height > 0) {
  15033. var xScale = _this.width * 1.0 / textSize.width;
  15034. var yScale = _this.height * 1.0 / textSize.height;
  15035. scale = Math.min(xScale, yScale);
  15036. x = (_this.width - textSize.width * scale) / 2;
  15037. y = (_this.height - textSize.height * scale) / 2;
  15038. }
  15039. _this.textElement.transform.baseVal.getItem(0).setTranslate(x, y);
  15040. _this.textElement.transform.baseVal.getItem(1).setScale(scale, scale);
  15041. };
  15042. _this.onDblClick = function (ev) {
  15043. _this.showEditor();
  15044. };
  15045. _this.onTap = function (ev) {
  15046. if (_this.inDoubleTap) {
  15047. _this.inDoubleTap = false;
  15048. _this.showEditor();
  15049. } else {
  15050. _this.inDoubleTap = true;
  15051. setTimeout(function () {
  15052. _this.inDoubleTap = false;
  15053. }, 300);
  15054. }
  15055. };
  15056. _this.showEditor = function () {
  15057. _this.editor = document.createElement('div');
  15058. _this.editor.className = 'fc-whiteboard-text-editor';
  15059. _this.editorTextArea = document.createElement('textarea');
  15060. if (_this.text !== _this.DEFAULT_TEXT) {
  15061. _this.editorTextArea.value = _this.text;
  15062. }
  15063. _this.editorTextArea.addEventListener('keydown', _this.onEditorKeyDown);
  15064. _this.editor.appendChild(_this.editorTextArea);
  15065. document.body.appendChild(_this.editor);
  15066. var buttons = document.createElement('div');
  15067. buttons.className = 'fc-whiteboard-text-editor-button-bar';
  15068. _this.editor.appendChild(buttons);
  15069. var okButton = document.createElement('div');
  15070. okButton.className = 'fc-whiteboard-text-editor-button';
  15071. okButton.innerHTML = OkIcon;
  15072. okButton.addEventListener('click', _this.onEditorOkClick);
  15073. buttons.appendChild(okButton);
  15074. var cancelButton = document.createElement('div');
  15075. cancelButton.className = 'fc-whiteboard-text-editor-button';
  15076. cancelButton.innerHTML = CancelIcon;
  15077. cancelButton.addEventListener('click', _this.closeEditor);
  15078. buttons.appendChild(cancelButton);
  15079. };
  15080. _this.onEditorOkClick = function (ev) {
  15081. if (_this.editorTextArea.value.trim()) {
  15082. _this.text = _this.editorTextArea.value;
  15083. } else {
  15084. _this.text = _this.DEFAULT_TEXT;
  15085. }
  15086. _this.onChange({
  15087. target: 'marker',
  15088. id: _this.id,
  15089. event: 'inputMarker',
  15090. marker: { text: _this.text }
  15091. });
  15092. _this.renderText();
  15093. _this.closeEditor();
  15094. };
  15095. _this.closeEditor = function () {
  15096. document.body.removeChild(_this.editor);
  15097. };
  15098. _this.onEditorKeyDown = function (ev) {
  15099. if (ev.key === 'Enter' && ev.ctrlKey) {
  15100. ev.preventDefault();
  15101. _this.onEditorOkClick(null);
  15102. }
  15103. };
  15104. return _this;
  15105. }
  15106. TextMarker.prototype.setText = function (text) {
  15107. this.text = text;
  15108. this.renderText();
  15109. };
  15110. TextMarker.prototype.captureSnap = function () {
  15111. var baseSnap = _super.prototype.captureSnap.call(this);
  15112. baseSnap.textSnap = { text: this.text };
  15113. return baseSnap;
  15114. };
  15115. TextMarker.prototype.applySnap = function (snap) {
  15116. _super.prototype.applySnap.call(this, snap);
  15117. if (snap.textSnap && snap.textSnap.text !== this.text) {
  15118. this.setText(snap.textSnap.text);
  15119. }
  15120. };
  15121. TextMarker.prototype.init = function () {
  15122. _super.prototype.init.call(this);
  15123. this.textElement = SvgHelper_1.SvgHelper.createText();
  15124. this.addToRenderVisual(this.textElement);
  15125. SvgHelper_1.SvgHelper.setAttributes(this.visual, [['class', 'text-marker']]);
  15126. this.textElement.transform.baseVal.appendItem(SvgHelper_1.SvgHelper.createTransform());
  15127. this.textElement.transform.baseVal.appendItem(SvgHelper_1.SvgHelper.createTransform());
  15128. this.renderText();
  15129. this.visual.addEventListener('dblclick', this.onDblClick);
  15130. this.visual.addEventListener('touchstart', this.onTap);
  15131. };
  15132. TextMarker.prototype.resize = function (x, y, onPosition) {
  15133. _super.prototype.resize.call(this, x, y, onPosition);
  15134. this.sizeText();
  15135. };
  15136. TextMarker.createMarker = function (page) {
  15137. var marker = new TextMarker();
  15138. marker.page = page;
  15139. marker.init();
  15140. return marker;
  15141. };
  15142. return TextMarker;
  15143. }(RectangularMarker_1.RectangularMarker);
  15144. exports.TextMarker = TextMarker;
  15145. /***/ }),
  15146. /***/ "./src/markers/types.ts":
  15147. /*!******************************!*\
  15148. !*** ./src/markers/types.ts ***!
  15149. \******************************/
  15150. /*! no static exports found */
  15151. /***/ (function(module, exports, __webpack_require__) {
  15152. "use strict";
  15153. Object.defineProperty(exports, "__esModule", { value: true });
  15154. var index_1 = __webpack_require__(/*! ./HighlightMarker/index */ "./src/markers/HighlightMarker/index.ts");
  15155. var index_2 = __webpack_require__(/*! ./TextMarker/index */ "./src/markers/TextMarker/index.ts");
  15156. var index_3 = __webpack_require__(/*! ./ArrowMarker/index */ "./src/markers/ArrowMarker/index.ts");
  15157. var index_4 = __webpack_require__(/*! ./BaseMarker/index */ "./src/markers/BaseMarker/index.ts");
  15158. var CoverMarker_1 = __webpack_require__(/*! ./CoverMarker */ "./src/markers/CoverMarker/index.ts");
  15159. var LineMarker_1 = __webpack_require__(/*! ./LineMarker */ "./src/markers/LineMarker/index.ts");
  15160. var RectMarker_1 = __webpack_require__(/*! ./RectMarker */ "./src/markers/RectMarker/index.ts");
  15161. function getMarkerByType(type) {
  15162. switch (type) {
  15163. case 'arrow':
  15164. return index_3.ArrowMarker;
  15165. case 'base':
  15166. return index_4.BaseMarker;
  15167. case 'cover':
  15168. return CoverMarker_1.CoverMarker;
  15169. case 'highlight':
  15170. return index_1.HighlightMarker;
  15171. case 'line':
  15172. return LineMarker_1.LineMarker;
  15173. case 'rect':
  15174. return RectMarker_1.RectMarker;
  15175. case 'text':
  15176. return index_2.TextMarker;
  15177. default:
  15178. return index_4.BaseMarker;
  15179. }
  15180. }
  15181. exports.getMarkerByType = getMarkerByType;
  15182. /***/ }),
  15183. /***/ "./src/renderer/DomEventAware/index.ts":
  15184. /*!*********************************************!*\
  15185. !*** ./src/renderer/DomEventAware/index.ts ***!
  15186. \*********************************************/
  15187. /*! no static exports found */
  15188. /***/ (function(module, exports, __webpack_require__) {
  15189. "use strict";
  15190. Object.defineProperty(exports, "__esModule", { value: true });
  15191. var DomEventAware = function () {
  15192. function DomEventAware() {
  15193. this.x = 0;
  15194. this.y = 0;
  15195. this.previousMouseX = 0;
  15196. this.previousMouseY = 0;
  15197. }
  15198. DomEventAware.prototype.init = function (ele) {
  15199. ele.addEventListener('mousedown', this.onMouseDown);
  15200. ele.addEventListener('mouseup', this.onMouseUp);
  15201. ele.addEventListener('mousemove', this.onMouseMove);
  15202. ele.addEventListener('touchstart', this.onTouch, { passive: false });
  15203. ele.addEventListener('touchend', this.onTouch, { passive: false });
  15204. ele.addEventListener('touchmove', this.onTouch, { passive: false });
  15205. };
  15206. DomEventAware.prototype.onTouch = function (ev) {
  15207. ev.preventDefault();
  15208. var newEvt = document.createEvent('MouseEvents');
  15209. var touch = ev.changedTouches[0];
  15210. var type = null;
  15211. switch (ev.type) {
  15212. case 'touchstart':
  15213. type = 'mousedown';
  15214. break;
  15215. case 'touchmove':
  15216. type = 'mousemove';
  15217. break;
  15218. case 'touchend':
  15219. type = 'mouseup';
  15220. break;
  15221. default:
  15222. break;
  15223. }
  15224. newEvt.initMouseEvent(type, true, true, window, 0, touch.screenX, touch.screenY, touch.clientX, touch.clientY, ev.ctrlKey, ev.altKey, ev.shiftKey, ev.metaKey, 0, null);
  15225. ev.target.dispatchEvent(newEvt);
  15226. };
  15227. return DomEventAware;
  15228. }();
  15229. exports.DomEventAware = DomEventAware;
  15230. /***/ }),
  15231. /***/ "./src/renderer/SvgHelper/index.ts":
  15232. /*!*****************************************!*\
  15233. !*** ./src/renderer/SvgHelper/index.ts ***!
  15234. \*****************************************/
  15235. /*! no static exports found */
  15236. /***/ (function(module, exports, __webpack_require__) {
  15237. "use strict";
  15238. Object.defineProperty(exports, "__esModule", { value: true });
  15239. var SvgHelper = function () {
  15240. function SvgHelper() {}
  15241. SvgHelper.createRect = function (width, height, attributes) {
  15242. var rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');
  15243. rect.setAttribute('width', width.toString());
  15244. rect.setAttribute('height', height.toString());
  15245. if (attributes) {
  15246. SvgHelper.setAttributes(rect, attributes);
  15247. }
  15248. return rect;
  15249. };
  15250. SvgHelper.createLine = function (x1, y1, x2, y2, attributes) {
  15251. var line = document.createElementNS('http://www.w3.org/2000/svg', 'line');
  15252. line.setAttribute('x1', x1.toString());
  15253. line.setAttribute('y1', y1.toString());
  15254. line.setAttribute('x2', x2.toString());
  15255. line.setAttribute('y2', y2.toString());
  15256. if (attributes) {
  15257. SvgHelper.setAttributes(line, attributes);
  15258. }
  15259. return line;
  15260. };
  15261. SvgHelper.createPolygon = function (points, attributes) {
  15262. var polygon = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');
  15263. polygon.setAttribute('points', points);
  15264. if (attributes) {
  15265. SvgHelper.setAttributes(polygon, attributes);
  15266. }
  15267. return polygon;
  15268. };
  15269. SvgHelper.createCircle = function (radius, attributes) {
  15270. var circle = document.createElementNS('http://www.w3.org/2000/svg', 'circle');
  15271. circle.setAttribute('cx', (radius / 2).toString());
  15272. circle.setAttribute('cy', (radius / 2).toString());
  15273. circle.setAttribute('r', radius.toString());
  15274. if (attributes) {
  15275. SvgHelper.setAttributes(circle, attributes);
  15276. }
  15277. return circle;
  15278. };
  15279. SvgHelper.createGroup = function (attributes) {
  15280. var g = document.createElementNS('http://www.w3.org/2000/svg', 'g');
  15281. if (attributes) {
  15282. SvgHelper.setAttributes(g, attributes);
  15283. }
  15284. return g;
  15285. };
  15286. SvgHelper.setAttributes = function (el, attributes) {
  15287. for (var _i = 0, attributes_1 = attributes; _i < attributes_1.length; _i++) {
  15288. var _a = attributes_1[_i],
  15289. attr = _a[0],
  15290. value = _a[1];
  15291. el.setAttribute(attr, value);
  15292. }
  15293. };
  15294. SvgHelper.createTransform = function () {
  15295. var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
  15296. return svg.createSVGTransform();
  15297. };
  15298. SvgHelper.createDefs = function () {
  15299. var defs = document.createElementNS('http://www.w3.org/2000/svg', 'defs');
  15300. return defs;
  15301. };
  15302. SvgHelper.createMarker = function (id, orient, markerWidth, markerHeight, refX, refY, markerElement) {
  15303. var marker = document.createElementNS('http://www.w3.org/2000/svg', 'marker');
  15304. SvgHelper.setAttributes(marker, [['id', id], ['orient', orient], ['markerWidth', markerWidth.toString()], ['markerHeight', markerHeight.toString()], ['refX', refX.toString()], ['refY', refY.toString()]]);
  15305. marker.appendChild(markerElement);
  15306. return marker;
  15307. };
  15308. SvgHelper.createText = function (attributes) {
  15309. var text = document.createElementNS('http://www.w3.org/2000/svg', 'text');
  15310. text.setAttribute('x', '0');
  15311. text.setAttribute('y', '0');
  15312. if (attributes) {
  15313. SvgHelper.setAttributes(text, attributes);
  15314. }
  15315. return text;
  15316. };
  15317. SvgHelper.createTSpan = function (text, attributes) {
  15318. var tspan = document.createElementNS('http://www.w3.org/2000/svg', 'tspan');
  15319. tspan.textContent = text;
  15320. if (attributes) {
  15321. SvgHelper.setAttributes(tspan, attributes);
  15322. }
  15323. return tspan;
  15324. };
  15325. return SvgHelper;
  15326. }();
  15327. exports.SvgHelper = SvgHelper;
  15328. /***/ }),
  15329. /***/ "./src/renderer/Synthetizer/index.ts":
  15330. /*!*******************************************!*\
  15331. !*** ./src/renderer/Synthetizer/index.ts ***!
  15332. \*******************************************/
  15333. /*! no static exports found */
  15334. /***/ (function(module, exports, __webpack_require__) {
  15335. "use strict";
  15336. Object.defineProperty(exports, "__esModule", { value: true });
  15337. var validator_1 = __webpack_require__(/*! ../../utils/validator */ "./src/utils/validator.ts");
  15338. var Synthetizer = function () {
  15339. function Synthetizer() {}
  15340. Synthetizer.prototype.rasterize = function (target, markerImage, done) {
  15341. if (!validator_1.isHTMLImageElement(target)) {
  15342. throw new Error('Error: only support export to HTMLImageElement');
  15343. }
  15344. var canvas = document.createElement('canvas');
  15345. canvas.width = markerImage.width.baseVal.value;
  15346. canvas.height = markerImage.height.baseVal.value;
  15347. var data = markerImage.outerHTML;
  15348. var ctx = canvas.getContext('2d');
  15349. if (!ctx) {
  15350. throw new Error('Invalid ctx');
  15351. }
  15352. ctx.drawImage(target, 0, 0, canvas.width, canvas.height);
  15353. var DOMURL = window.URL;
  15354. var img = new Image(canvas.width, canvas.height);
  15355. img.setAttribute('crossOrigin', 'anonymous');
  15356. var blob = new Blob([data], { type: 'image/svg+xml' });
  15357. var url = DOMURL.createObjectURL(blob);
  15358. img.onload = function () {
  15359. ctx.drawImage(img, 0, 0);
  15360. DOMURL.revokeObjectURL(url);
  15361. done(canvas.toDataURL('image/png'));
  15362. };
  15363. img.src = url;
  15364. };
  15365. return Synthetizer;
  15366. }();
  15367. exports.Synthetizer = Synthetizer;
  15368. /***/ }),
  15369. /***/ "./src/toolbar/Toolbar.ts":
  15370. /*!********************************!*\
  15371. !*** ./src/toolbar/Toolbar.ts ***!
  15372. \********************************/
  15373. /*! no static exports found */
  15374. /***/ (function(module, exports, __webpack_require__) {
  15375. "use strict";
  15376. var __extends = this && this.__extends || function () {
  15377. var extendStatics = function (d, b) {
  15378. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  15379. d.__proto__ = b;
  15380. } || function (d, b) {
  15381. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  15382. };
  15383. return extendStatics(d, b);
  15384. };
  15385. return function (d, b) {
  15386. extendStatics(d, b);
  15387. function __() {
  15388. this.constructor = d;
  15389. }
  15390. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  15391. };
  15392. }();
  15393. Object.defineProperty(exports, "__esModule", { value: true });
  15394. var interactjs_1 = __webpack_require__(/*! interactjs */ "./node_modules/interactjs/dist/interact.js");
  15395. var ToolbarButton_1 = __webpack_require__(/*! ./ToolbarButton */ "./src/toolbar/ToolbarButton.ts");
  15396. var uuid_1 = __webpack_require__(/*! ../utils/uuid */ "./src/utils/uuid.ts");
  15397. __webpack_require__(/*! ./index.less */ "./src/toolbar/index.less");
  15398. var index_1 = __webpack_require__(/*! ../renderer/DomEventAware/index */ "./src/renderer/DomEventAware/index.ts");
  15399. var toolbar_items_1 = __webpack_require__(/*! ./toolbar-items */ "./src/toolbar/toolbar-items.ts");
  15400. var Toolbar = function (_super) {
  15401. __extends(Toolbar, _super);
  15402. function Toolbar(toolbarItems, clickHandler) {
  15403. var _this = _super.call(this) || this;
  15404. _this.id = uuid_1.uuid();
  15405. _this.zIndex = 999;
  15406. _this.toolbarButtons = [];
  15407. _this.getUI = function (drawboard) {
  15408. _this.toolbarUI = document.createElement('div');
  15409. _this.toolbarUI.id = "fcw-toolbar-" + _this.id;
  15410. _this.toolbarUI.className = 'fc-whiteboard-toolbar';
  15411. for (var _i = 0, _a = _this.toolbarItems; _i < _a.length; _i++) {
  15412. var toolbarItem = _a[_i];
  15413. var toolbarButton = new ToolbarButton_1.ToolbarButton(toolbarItem, _this.clickHandler);
  15414. toolbarButton.drawboard = drawboard;
  15415. _this.toolbarUI.appendChild(toolbarButton.getElement());
  15416. _this.toolbarButtons.push(toolbarButton);
  15417. }
  15418. _super.prototype.init.call(_this, _this.toolbarUI);
  15419. interactjs_1.default('#drag-handler').draggable({
  15420. onmove: _this.onDragMove
  15421. });
  15422. return _this.toolbarUI;
  15423. };
  15424. _this.onMouseDown = function (downEv) {};
  15425. _this.onMouseUp = function (ev) {};
  15426. _this.onMouseMove = function (ev) {};
  15427. _this.onDragMove = function (event) {
  15428. var target = _this.toolbarUI;
  15429. var x = (parseFloat(target.getAttribute('data-x')) || 0) + event.dx;
  15430. var y = (parseFloat(target.getAttribute('data-y')) || 0) + event.dy;
  15431. target.style.webkitTransform = target.style.transform = 'translate(' + x + 'px, ' + y + 'px)';
  15432. target.style.zIndex = "" + _this.zIndex;
  15433. target.setAttribute('data-x', x);
  15434. target.setAttribute('data-y', y);
  15435. };
  15436. _this.toolbarItems = [toolbar_items_1.dragToolbarItem].concat(toolbarItems);
  15437. _this.clickHandler = clickHandler;
  15438. return _this;
  15439. }
  15440. Object.defineProperty(Toolbar.prototype, "toolbarButtonMap", {
  15441. get: function () {
  15442. var buttonMap = {};
  15443. this.toolbarButtons.forEach(function (b) {
  15444. buttonMap[b.id] = b;
  15445. });
  15446. return buttonMap;
  15447. },
  15448. enumerable: true,
  15449. configurable: true
  15450. });
  15451. Toolbar.prototype.hide = function () {
  15452. this.toolbarUI.style.visibility = 'hidden';
  15453. this.toolbarUI.style.zIndex = '-1';
  15454. };
  15455. Toolbar.prototype.show = function () {
  15456. this.toolbarUI.style.visibility = 'visible';
  15457. this.toolbarUI.style.zIndex = "" + this.zIndex;
  15458. };
  15459. return Toolbar;
  15460. }(index_1.DomEventAware);
  15461. exports.Toolbar = Toolbar;
  15462. /***/ }),
  15463. /***/ "./src/toolbar/ToolbarButton.ts":
  15464. /*!**************************************!*\
  15465. !*** ./src/toolbar/ToolbarButton.ts ***!
  15466. \**************************************/
  15467. /*! no static exports found */
  15468. /***/ (function(module, exports, __webpack_require__) {
  15469. "use strict";
  15470. Object.defineProperty(exports, "__esModule", { value: true });
  15471. var tippy_js_1 = __webpack_require__(/*! tippy.js */ "./node_modules/tippy.js/esm/index.all.js");
  15472. var uuid_1 = __webpack_require__(/*! ../utils/uuid */ "./src/utils/uuid.ts");
  15473. var ToolbarButton = function () {
  15474. function ToolbarButton(toolbarItem, clickHandler) {
  15475. var _this = this;
  15476. this.id = uuid_1.uuid();
  15477. this.getElement = function () {
  15478. if (_this.toolbarItem.onRender) {
  15479. _this.container = _this.toolbarItem.onRender().cloneNode(true);
  15480. return _this.container;
  15481. }
  15482. var div = document.createElement('div');
  15483. if (_this.toolbarItem.name !== 'separator') {
  15484. div.className = 'fc-whiteboard-toolbar-button';
  15485. if (_this.clickHandler) {
  15486. div.addEventListener('click', function (ev) {
  15487. if (_this.clickHandler) {
  15488. _this.clickHandler(ev, _this.toolbarItem);
  15489. }
  15490. });
  15491. }
  15492. if (_this.toolbarItem.icon) {
  15493. div.title = _this.toolbarItem.tooltipText || '';
  15494. div.innerHTML = _this.toolbarItem.icon;
  15495. } else {
  15496. div.innerText = _this.toolbarItem.tooltipText || '';
  15497. }
  15498. if (_this.toolbarItem.tooltipText) {
  15499. tippy_js_1.default(div, {
  15500. content: _this.toolbarItem.shortcut ? _this.toolbarItem.tooltipText + " " + _this.toolbarItem.shortcut : _this.toolbarItem.tooltipText
  15501. });
  15502. }
  15503. } else {
  15504. div.className = 'fc-whiteboard-toolbar-separator';
  15505. }
  15506. div.id = "fc-whiteboard-toolbar-" + _this.toolbarItem.name;
  15507. _this.container = div;
  15508. return div;
  15509. };
  15510. this.toolbarItem = toolbarItem;
  15511. if (clickHandler) {
  15512. this.clickHandler = clickHandler;
  15513. }
  15514. }
  15515. return ToolbarButton;
  15516. }();
  15517. exports.ToolbarButton = ToolbarButton;
  15518. /***/ }),
  15519. /***/ "./src/toolbar/ToolbarItem.ts":
  15520. /*!************************************!*\
  15521. !*** ./src/toolbar/ToolbarItem.ts ***!
  15522. \************************************/
  15523. /*! no static exports found */
  15524. /***/ (function(module, exports, __webpack_require__) {
  15525. "use strict";
  15526. Object.defineProperty(exports, "__esModule", { value: true });
  15527. var ToolbarItem = function () {
  15528. function ToolbarItem(_a) {
  15529. var name = _a.name,
  15530. tooltipText = _a.tooltipText,
  15531. shortcut = _a.shortcut,
  15532. icon = _a.icon,
  15533. draggable = _a.draggable,
  15534. markerType = _a.markerType,
  15535. onRender = _a.onRender,
  15536. onClick = _a.onClick;
  15537. if (!name) {
  15538. throw new Error('Invalid params');
  15539. }
  15540. this.name = name;
  15541. this.tooltipText = tooltipText;
  15542. this.shortcut = shortcut;
  15543. this.icon = icon;
  15544. this.markerType = markerType;
  15545. this.draggable = draggable;
  15546. this.onClick = onClick;
  15547. this.onRender = onRender;
  15548. }
  15549. return ToolbarItem;
  15550. }();
  15551. exports.ToolbarItem = ToolbarItem;
  15552. /***/ }),
  15553. /***/ "./src/toolbar/index.less":
  15554. /*!********************************!*\
  15555. !*** ./src/toolbar/index.less ***!
  15556. \********************************/
  15557. /*! no static exports found */
  15558. /***/ (function(module, exports, __webpack_require__) {
  15559. var content = __webpack_require__(/*! !../../node_modules/css-loader/dist/cjs.js??ref--11-1!../../node_modules/postcss-loader/src!../../node_modules/less-loader/dist/cjs.js??ref--11-3!./index.less */ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/toolbar/index.less");
  15560. if(typeof content === 'string') content = [[module.i, content, '']];
  15561. var transform;
  15562. var insertInto;
  15563. var options = {"hmr":true}
  15564. options.transform = transform
  15565. options.insertInto = undefined;
  15566. var update = __webpack_require__(/*! ../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  15567. if(content.locals) module.exports = content.locals;
  15568. if(false) {}
  15569. /***/ }),
  15570. /***/ "./src/toolbar/toolbar-items.ts":
  15571. /*!**************************************!*\
  15572. !*** ./src/toolbar/toolbar-items.ts ***!
  15573. \**************************************/
  15574. /*! no static exports found */
  15575. /***/ (function(module, exports, __webpack_require__) {
  15576. "use strict";
  15577. Object.defineProperty(exports, "__esModule", { value: true });
  15578. var index_1 = __webpack_require__(/*! ./../markers/RectMarker/index */ "./src/markers/RectMarker/index.ts");
  15579. var index_2 = __webpack_require__(/*! ./../markers/CoverMarker/index */ "./src/markers/CoverMarker/index.ts");
  15580. var index_3 = __webpack_require__(/*! ./../markers/TextMarker/index */ "./src/markers/TextMarker/index.ts");
  15581. var index_4 = __webpack_require__(/*! ./../markers/ArrowMarker/index */ "./src/markers/ArrowMarker/index.ts");
  15582. var index_5 = __webpack_require__(/*! ./../markers/HighlightMarker/index */ "./src/markers/HighlightMarker/index.ts");
  15583. var ToolbarItem_1 = __webpack_require__(/*! ./ToolbarItem */ "./src/toolbar/ToolbarItem.ts");
  15584. var LineMarker_1 = __webpack_require__(/*! ../markers/LineMarker */ "./src/markers/LineMarker/index.ts");
  15585. var OkIcon = __webpack_require__(/*! ../assets/check.svg */ "./src/assets/check.svg");
  15586. var DeleteIcon = __webpack_require__(/*! ../assets/eraser.svg */ "./src/assets/eraser.svg");
  15587. var CloseIcon = __webpack_require__(/*! ../assets/times.svg */ "./src/assets/times.svg");
  15588. exports.dragToolbarItem = new ToolbarItem_1.ToolbarItem({
  15589. name: 'drag',
  15590. tooltipText: 'Drag',
  15591. icon: __webpack_require__(/*! ../assets/drag.svg */ "./src/assets/drag.svg")
  15592. });
  15593. exports.highlightMarkerToolbarItem = new ToolbarItem_1.ToolbarItem({
  15594. name: 'cover-marker',
  15595. tooltipText: 'Hightlight',
  15596. shortcut: 'Shift+H',
  15597. icon: __webpack_require__(/*! ../assets/highlight.svg */ "./src/assets/highlight.svg"),
  15598. markerType: index_5.HighlightMarker,
  15599. draggable: true
  15600. });
  15601. exports.arrowMarkerToolbarItem = new ToolbarItem_1.ToolbarItem({
  15602. name: 'arrow-marker',
  15603. tooltipText: 'Arrow',
  15604. shortcut: 'Shift+A',
  15605. icon: __webpack_require__(/*! ../assets/arrow.svg */ "./src/assets/arrow.svg"),
  15606. markerType: index_4.ArrowMarker,
  15607. draggable: true
  15608. });
  15609. exports.textMarkerToolbarItem = new ToolbarItem_1.ToolbarItem({
  15610. name: 'text-marker',
  15611. tooltipText: 'Text',
  15612. shortcut: 'Shift+T',
  15613. icon: __webpack_require__(/*! ../assets/text.svg */ "./src/assets/text.svg"),
  15614. markerType: index_3.TextMarker,
  15615. draggable: true
  15616. });
  15617. exports.coverMarkerToolbarItem = new ToolbarItem_1.ToolbarItem({
  15618. name: 'cover-marker',
  15619. tooltipText: 'Cover',
  15620. shortcut: 'Shift+C',
  15621. icon: __webpack_require__(/*! ../assets/cover.svg */ "./src/assets/cover.svg"),
  15622. markerType: index_2.CoverMarker,
  15623. draggable: true
  15624. });
  15625. exports.rectMarkerToolbarItem = new ToolbarItem_1.ToolbarItem({
  15626. name: 'rect-marker',
  15627. tooltipText: 'Rectangle',
  15628. shortcut: 'Shift+R',
  15629. icon: __webpack_require__(/*! ../assets/rect.svg */ "./src/assets/rect.svg"),
  15630. markerType: index_1.RectMarker,
  15631. draggable: true
  15632. });
  15633. exports.lineMarkerToolbarItem = new ToolbarItem_1.ToolbarItem({
  15634. name: 'line-marker',
  15635. tooltipText: 'Line',
  15636. shortcut: 'Shift+L',
  15637. icon: __webpack_require__(/*! ../assets/line.svg */ "./src/assets/line.svg"),
  15638. markerType: LineMarker_1.LineMarker,
  15639. draggable: true
  15640. });
  15641. exports.closeToolbarItem = new ToolbarItem_1.ToolbarItem({
  15642. icon: CloseIcon,
  15643. name: 'close',
  15644. tooltipText: 'Close'
  15645. });
  15646. exports.separatorToolbarItem = new ToolbarItem_1.ToolbarItem({ name: 'separator', tooltipText: '' });
  15647. function getToolbars(page) {
  15648. var toolbars = [{
  15649. icon: DeleteIcon,
  15650. name: 'delete',
  15651. tooltipText: 'Delete'
  15652. }, exports.rectMarkerToolbarItem, exports.coverMarkerToolbarItem, exports.highlightMarkerToolbarItem, exports.lineMarkerToolbarItem, exports.arrowMarkerToolbarItem, exports.textMarkerToolbarItem];
  15653. if (!page) {
  15654. toolbars.push.apply(toolbars, [{
  15655. icon: OkIcon,
  15656. name: 'ok',
  15657. tooltipText: 'OK'
  15658. }]);
  15659. }
  15660. return toolbars;
  15661. }
  15662. exports.getToolbars = getToolbars;
  15663. /***/ }),
  15664. /***/ "./src/utils/dom.ts":
  15665. /*!**************************!*\
  15666. !*** ./src/utils/dom.ts ***!
  15667. \**************************/
  15668. /*! no static exports found */
  15669. /***/ (function(module, exports, __webpack_require__) {
  15670. "use strict";
  15671. Object.defineProperty(exports, "__esModule", { value: true });
  15672. function createDivWithClassName(className, parent) {
  15673. var ele = document.createElement('div');
  15674. if (parent) {
  15675. parent.appendChild(ele);
  15676. }
  15677. if (className) {
  15678. addClassName(ele, className);
  15679. }
  15680. return ele;
  15681. }
  15682. exports.createDivWithClassName = createDivWithClassName;
  15683. function addClassName(ele, className) {
  15684. if (!ele) {
  15685. return;
  15686. }
  15687. ele.className = ((ele.className || '') + " " + className).trim();
  15688. }
  15689. exports.addClassName = addClassName;
  15690. /***/ }),
  15691. /***/ "./src/utils/layout.ts":
  15692. /*!*****************************!*\
  15693. !*** ./src/utils/layout.ts ***!
  15694. \*****************************/
  15695. /*! no static exports found */
  15696. /***/ (function(module, exports, __webpack_require__) {
  15697. "use strict";
  15698. Object.defineProperty(exports, "__esModule", { value: true });
  15699. function rectContains(rect, _a) {
  15700. var x = _a.x,
  15701. y = _a.y;
  15702. if (x < rect.left || x > rect.left + rect.width || y < rect.top || y > rect.top + rect.height) {
  15703. return false;
  15704. }
  15705. return true;
  15706. }
  15707. exports.rectContains = rectContains;
  15708. /***/ }),
  15709. /***/ "./src/utils/types.ts":
  15710. /*!****************************!*\
  15711. !*** ./src/utils/types.ts ***!
  15712. \****************************/
  15713. /*! no static exports found */
  15714. /***/ (function(module, exports, __webpack_require__) {
  15715. "use strict";
  15716. Object.defineProperty(exports, "__esModule", { value: true });
  15717. function isNil(mayBeNil) {
  15718. return mayBeNil === null || mayBeNil === undefined;
  15719. }
  15720. exports.isNil = isNil;
  15721. /***/ }),
  15722. /***/ "./src/utils/uuid.ts":
  15723. /*!***************************!*\
  15724. !*** ./src/utils/uuid.ts ***!
  15725. \***************************/
  15726. /*! no static exports found */
  15727. /***/ (function(module, exports, __webpack_require__) {
  15728. "use strict";
  15729. Object.defineProperty(exports, "__esModule", { value: true });
  15730. var uuidV1 = __webpack_require__(/*! uuid/v1 */ "./node_modules/uuid/v1.js");
  15731. exports.uuid = uuidV1;
  15732. /***/ }),
  15733. /***/ "./src/utils/validator.ts":
  15734. /*!********************************!*\
  15735. !*** ./src/utils/validator.ts ***!
  15736. \********************************/
  15737. /*! no static exports found */
  15738. /***/ (function(module, exports, __webpack_require__) {
  15739. "use strict";
  15740. Object.defineProperty(exports, "__esModule", { value: true });
  15741. function isHTMLImageElement(ele) {
  15742. if (typeof ele === 'object' && ele instanceof HTMLImageElement) {
  15743. return true;
  15744. }
  15745. return false;
  15746. }
  15747. exports.isHTMLImageElement = isHTMLImageElement;
  15748. /***/ }),
  15749. /***/ "./src/whiteboard/AbstractWhiteboard/index.less":
  15750. /*!******************************************************!*\
  15751. !*** ./src/whiteboard/AbstractWhiteboard/index.less ***!
  15752. \******************************************************/
  15753. /*! no static exports found */
  15754. /***/ (function(module, exports, __webpack_require__) {
  15755. var content = __webpack_require__(/*! !../../../node_modules/css-loader/dist/cjs.js??ref--11-1!../../../node_modules/postcss-loader/src!../../../node_modules/less-loader/dist/cjs.js??ref--11-3!./index.less */ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/whiteboard/AbstractWhiteboard/index.less");
  15756. if(typeof content === 'string') content = [[module.i, content, '']];
  15757. var transform;
  15758. var insertInto;
  15759. var options = {"hmr":true}
  15760. options.transform = transform
  15761. options.insertInto = undefined;
  15762. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  15763. if(content.locals) module.exports = content.locals;
  15764. if(false) {}
  15765. /***/ }),
  15766. /***/ "./src/whiteboard/AbstractWhiteboard/index.ts":
  15767. /*!****************************************************!*\
  15768. !*** ./src/whiteboard/AbstractWhiteboard/index.ts ***!
  15769. \****************************************************/
  15770. /*! no static exports found */
  15771. /***/ (function(module, exports, __webpack_require__) {
  15772. "use strict";
  15773. Object.defineProperty(exports, "__esModule", { value: true });
  15774. var index_1 = __webpack_require__(/*! ../WhitePage/index */ "./src/whiteboard/WhitePage/index.ts");
  15775. var uuid_1 = __webpack_require__(/*! ../../utils/uuid */ "./src/utils/uuid.ts");
  15776. var dom_1 = __webpack_require__(/*! ../../utils/dom */ "./src/utils/dom.ts");
  15777. __webpack_require__(/*! ./index.less */ "./src/whiteboard/AbstractWhiteboard/index.less");
  15778. var Siema = __webpack_require__(/*! siema */ "./node_modules/siema/dist/siema.min.js");
  15779. var prefix = 'fcw-board';
  15780. var AbstractWhiteboard = function () {
  15781. function AbstractWhiteboard(target, _a) {
  15782. var _b = _a === void 0 ? {} : _a,
  15783. sources = _b.sources,
  15784. eventHub = _b.eventHub,
  15785. visiblePageIndex = _b.visiblePageIndex,
  15786. allowRollback = _b.allowRollback,
  15787. onlyEmitSnap = _b.onlyEmitSnap;
  15788. this.id = uuid_1.uuid();
  15789. this.sources = [];
  15790. this.imgEles = [];
  15791. this.allowRollback = false;
  15792. this.onlyEmitSnap = false;
  15793. this.snapInterval = 15 * 1000;
  15794. this.mode = 'master';
  15795. this.isFullscreen = false;
  15796. this.pages = [];
  15797. this.snapHistory = [];
  15798. this.isInitialized = false;
  15799. this.isSyncing = false;
  15800. this.visiblePageIndex = 0;
  15801. if (target) {
  15802. this.target = target;
  15803. } else {
  15804. this.target = document.createElement('div');
  15805. document.body.appendChild(this.target);
  15806. }
  15807. if (!this.target.id) {
  15808. this.target.id = this.id;
  15809. }
  15810. dom_1.addClassName(this.target, prefix);
  15811. if (sources) {
  15812. this.sources = sources;
  15813. }
  15814. this.eventHub = eventHub;
  15815. if (typeof visiblePageIndex !== 'undefined') {
  15816. this.visiblePageIndex = visiblePageIndex;
  15817. }
  15818. this.onlyEmitSnap = !!onlyEmitSnap;
  15819. if (typeof allowRollback !== 'undefined') {
  15820. this.allowRollback = !!allowRollback;
  15821. }
  15822. this.init();
  15823. }
  15824. Object.defineProperty(AbstractWhiteboard.prototype, "activePage", {
  15825. get: function () {
  15826. return this.pages[this.visiblePageIndex];
  15827. },
  15828. enumerable: true,
  15829. configurable: true
  15830. });
  15831. Object.defineProperty(AbstractWhiteboard.prototype, "pageMap", {
  15832. get: function () {
  15833. var map = {};
  15834. this.pages.forEach(function (p) {
  15835. return map[p.id] = p;
  15836. });
  15837. return map;
  15838. },
  15839. enumerable: true,
  15840. configurable: true
  15841. });
  15842. AbstractWhiteboard.prototype.open = function () {
  15843. var _this = this;
  15844. this.pages.forEach(function (page, i) {
  15845. page.open();
  15846. if (i !== _this.visiblePageIndex) {
  15847. page.hide();
  15848. }
  15849. });
  15850. };
  15851. AbstractWhiteboard.prototype.close = function () {
  15852. if (this.emitInterval) {
  15853. clearInterval(this.emitInterval);
  15854. }
  15855. };
  15856. AbstractWhiteboard.prototype.show = function () {
  15857. if (this.activePage) {
  15858. this.activePage.show();
  15859. }
  15860. };
  15861. AbstractWhiteboard.prototype.hide = function () {
  15862. if (this.activePage) {
  15863. this.activePage.hide();
  15864. }
  15865. };
  15866. AbstractWhiteboard.prototype.emit = function (borderEvent) {
  15867. if (this.mode !== 'master' || !this.eventHub) {
  15868. return;
  15869. }
  15870. if (this.onlyEmitSnap) {
  15871. if (borderEvent.event !== 'borderSnap') {
  15872. return;
  15873. }
  15874. }
  15875. if (this.allowRollback && (borderEvent.event === 'addMarker' || borderEvent.event === 'removeMarker')) {
  15876. if (this.snapHistory.length > 20) {
  15877. this.snapHistory.shift();
  15878. }
  15879. this.snapHistory.push(this.captureSnap(false));
  15880. }
  15881. borderEvent.timestamp = Math.floor(Date.now() / 1000);
  15882. this.eventHub.emit('sync', borderEvent);
  15883. };
  15884. AbstractWhiteboard.prototype.captureSnap = function (shadow) {
  15885. if (shadow === void 0) {
  15886. shadow = true;
  15887. }
  15888. if (shadow) {
  15889. return {
  15890. id: this.id,
  15891. sources: this.sources,
  15892. pageIds: this.pages.map(function (page) {
  15893. return page.id;
  15894. }),
  15895. visiblePageIndex: this.visiblePageIndex
  15896. };
  15897. }
  15898. return {
  15899. id: this.id,
  15900. sources: this.sources,
  15901. pageIds: this.pages.map(function (page) {
  15902. return page.id;
  15903. }),
  15904. visiblePageIndex: this.visiblePageIndex,
  15905. pages: this.pages.map(function (p) {
  15906. return p.captureSnap();
  15907. })
  15908. };
  15909. };
  15910. AbstractWhiteboard.prototype.rollbackSnap = function () {
  15911. if (this.snapHistory.length === 0) {
  15912. return;
  15913. }
  15914. this.snapHistory.pop();
  15915. var snap = this.snapHistory[this.snapHistory.length - 1];
  15916. if (snap) {
  15917. this.applySnap(snap);
  15918. }
  15919. };
  15920. AbstractWhiteboard.prototype.destroy = function () {
  15921. if (this.emitInterval) {
  15922. clearInterval(this.emitInterval);
  15923. }
  15924. if (this.eventHub) {
  15925. this.eventHub.removeAllListeners();
  15926. }
  15927. if (this.siema) {
  15928. this.siema.destroy();
  15929. }
  15930. this.imgsContainer.remove();
  15931. this.pagesContainer.remove();
  15932. this.pages.forEach(function (page) {
  15933. page.destroy();
  15934. });
  15935. };
  15936. AbstractWhiteboard.prototype.initSiema = function () {
  15937. var _this = this;
  15938. this.sources.forEach(function (source) {
  15939. var imgEle = document.createElement('div');
  15940. dom_1.addClassName(imgEle, prefix + "-img-wrapper");
  15941. imgEle.style.backgroundImage = "url(" + source + ")";
  15942. _this.imgEles.push(imgEle);
  15943. _this.imgsContainer.appendChild(imgEle);
  15944. });
  15945. this.siema = new Siema({
  15946. selector: this.imgsContainer,
  15947. duration: 200,
  15948. easing: 'ease-out',
  15949. perPage: 1,
  15950. startIndex: 0,
  15951. draggable: false,
  15952. multipleDrag: true,
  15953. threshold: 20,
  15954. loop: false,
  15955. rtl: false
  15956. });
  15957. };
  15958. AbstractWhiteboard.prototype.applySnap = function (snap) {
  15959. var _this = this;
  15960. var id = snap.id,
  15961. sources = snap.sources,
  15962. pageIds = snap.pageIds;
  15963. if (!this.isInitialized && !this.isSyncing) {
  15964. this.id = id;
  15965. this.sources = sources;
  15966. this.isSyncing = true;
  15967. this.sources.forEach(function (source, i) {
  15968. var page = new index_1.WhitePage({ imgSrc: source }, {
  15969. mode: _this.mode,
  15970. whiteboard: _this,
  15971. parentContainer: _this.pagesContainer
  15972. });
  15973. page.id = pageIds[i];
  15974. page.container.style.visibility = 'hidden';
  15975. _this.pages.push(page);
  15976. page.open();
  15977. });
  15978. this.initSiema();
  15979. this.isInitialized = true;
  15980. this.isSyncing = false;
  15981. }
  15982. this.onPageChange(snap.visiblePageIndex);
  15983. (snap.pages || []).forEach(function (pageSnap) {
  15984. var page = _this.pageMap[pageSnap.id];
  15985. if (page) {
  15986. page.applySnap(pageSnap);
  15987. }
  15988. });
  15989. };
  15990. return AbstractWhiteboard;
  15991. }();
  15992. exports.AbstractWhiteboard = AbstractWhiteboard;
  15993. /***/ }),
  15994. /***/ "./src/whiteboard/MirrorWhiteboard/index.ts":
  15995. /*!**************************************************!*\
  15996. !*** ./src/whiteboard/MirrorWhiteboard/index.ts ***!
  15997. \**************************************************/
  15998. /*! no static exports found */
  15999. /***/ (function(module, exports, __webpack_require__) {
  16000. "use strict";
  16001. var __extends = this && this.__extends || function () {
  16002. var extendStatics = function (d, b) {
  16003. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16004. d.__proto__ = b;
  16005. } || function (d, b) {
  16006. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  16007. };
  16008. return extendStatics(d, b);
  16009. };
  16010. return function (d, b) {
  16011. extendStatics(d, b);
  16012. function __() {
  16013. this.constructor = d;
  16014. }
  16015. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16016. };
  16017. }();
  16018. Object.defineProperty(exports, "__esModule", { value: true });
  16019. var dom_1 = __webpack_require__(/*! ../../utils/dom */ "./src/utils/dom.ts");
  16020. var index_1 = __webpack_require__(/*! ../AbstractWhiteboard/index */ "./src/whiteboard/AbstractWhiteboard/index.ts");
  16021. var prefix = 'fcw-board';
  16022. var MirrorWhiteboard = function (_super) {
  16023. __extends(MirrorWhiteboard, _super);
  16024. function MirrorWhiteboard() {
  16025. var _this = _super !== null && _super.apply(this, arguments) || this;
  16026. _this.mode = 'mirror';
  16027. return _this;
  16028. }
  16029. MirrorWhiteboard.prototype.init = function () {
  16030. var _this = this;
  16031. this.imgsContainer = dom_1.createDivWithClassName(prefix + "-imgs", this.target);
  16032. this.pagesContainer = dom_1.createDivWithClassName(prefix + "-pages", this.target);
  16033. if (!this.eventHub) {
  16034. throw new Error('Invalid eventHub');
  16035. }
  16036. this.eventHub.on('sync', function (ev) {
  16037. if (ev.target !== 'whiteboard' || !ev.border) {
  16038. return;
  16039. }
  16040. if (ev.event === 'borderSnap') {
  16041. _this.applySnap(ev.border);
  16042. }
  16043. if (ev.event === 'borderChangePage' && ev.id === _this.id) {
  16044. if (_this.isInitialized) {
  16045. _this.onPageChange(ev.border.visiblePageIndex);
  16046. }
  16047. }
  16048. if (ev.event === 'finish' && ev.id === _this.id) {
  16049. _this.destroy();
  16050. }
  16051. });
  16052. };
  16053. MirrorWhiteboard.prototype.destroy = function () {
  16054. _super.prototype.destroy.call(this);
  16055. };
  16056. MirrorWhiteboard.prototype.onPageChange = function (nextPageIndex) {
  16057. if (this.visiblePageIndex === nextPageIndex) {
  16058. return;
  16059. }
  16060. this.siema.goTo(nextPageIndex);
  16061. this.visiblePageIndex = nextPageIndex;
  16062. this.pages.forEach(function (page, i) {
  16063. if (nextPageIndex === i) {
  16064. page.show();
  16065. } else {
  16066. page.hide();
  16067. }
  16068. });
  16069. this.emit({
  16070. event: 'borderChangePage',
  16071. id: this.id,
  16072. target: 'whiteboard',
  16073. border: this.captureSnap()
  16074. });
  16075. };
  16076. return MirrorWhiteboard;
  16077. }(index_1.AbstractWhiteboard);
  16078. exports.MirrorWhiteboard = MirrorWhiteboard;
  16079. /***/ }),
  16080. /***/ "./src/whiteboard/ReplayWhiteboard/index.ts":
  16081. /*!**************************************************!*\
  16082. !*** ./src/whiteboard/ReplayWhiteboard/index.ts ***!
  16083. \**************************************************/
  16084. /*! no static exports found */
  16085. /***/ (function(module, exports, __webpack_require__) {
  16086. "use strict";
  16087. var __extends = this && this.__extends || function () {
  16088. var extendStatics = function (d, b) {
  16089. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16090. d.__proto__ = b;
  16091. } || function (d, b) {
  16092. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  16093. };
  16094. return extendStatics(d, b);
  16095. };
  16096. return function (d, b) {
  16097. extendStatics(d, b);
  16098. function __() {
  16099. this.constructor = d;
  16100. }
  16101. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16102. };
  16103. }();
  16104. Object.defineProperty(exports, "__esModule", { value: true });
  16105. var MirrorWhiteboard_1 = __webpack_require__(/*! ../MirrorWhiteboard */ "./src/whiteboard/MirrorWhiteboard/index.ts");
  16106. var EventHub_1 = __webpack_require__(/*! ../../event/EventHub */ "./src/event/EventHub.ts");
  16107. var windowSize = 60 * 1000;
  16108. var duration = 0.05;
  16109. var ReplayWhiteboard = function (_super) {
  16110. __extends(ReplayWhiteboard, _super);
  16111. function ReplayWhiteboard() {
  16112. var _this = _super !== null && _super.apply(this, arguments) || this;
  16113. _this.leftEvents = [];
  16114. _this.currentRelativeTime = 0;
  16115. _this.loadedRelativeTime = -1;
  16116. _this.loadingLock = false;
  16117. _this.seekingLock = false;
  16118. _this.seek = function () {
  16119. if (_this.seekingLock) {
  16120. return;
  16121. }
  16122. _this.seekingLock = true;
  16123. if (_this.loadedRelativeTime < _this.currentRelativeTime) {
  16124. _this.loadEvents();
  16125. }
  16126. var waitingEvents = [];
  16127. var leftEvents = [];
  16128. _this.leftEvents.forEach(function (e, i) {
  16129. if (e.timestamp && e.timestamp < _this.currentRelativeTime + _this.recordStartTime) {
  16130. waitingEvents.push(e);
  16131. } else {
  16132. leftEvents.push(e);
  16133. }
  16134. });
  16135. _this.leftEvents = leftEvents;
  16136. waitingEvents.forEach(function (e) {
  16137. _this.perform(e);
  16138. });
  16139. _this.currentRelativeTime += duration;
  16140. _this.seekingLock = false;
  16141. };
  16142. _this.perform = function (e) {
  16143. _this.eventHub.emit('sync', e);
  16144. };
  16145. return _this;
  16146. }
  16147. ReplayWhiteboard.prototype.setContext = function (recordStartTime, onLoad) {
  16148. var _this = this;
  16149. this.recordStartTime = recordStartTime;
  16150. this.onLoad = onLoad;
  16151. if (this.interval) {
  16152. clearInterval(this.interval);
  16153. }
  16154. this.interval = setInterval(function () {
  16155. _this.seek();
  16156. }, duration * 1000);
  16157. };
  16158. ReplayWhiteboard.prototype.setCurrentRelativeTime = function (time) {
  16159. this.currentRelativeTime = time;
  16160. this.loadedRelativeTime = this.currentRelativeTime - 1;
  16161. };
  16162. ReplayWhiteboard.prototype.close = function () {
  16163. _super.prototype.close.call(this);
  16164. if (this.interval) {
  16165. clearInterval(this.interval);
  16166. }
  16167. };
  16168. ReplayWhiteboard.prototype.init = function () {
  16169. this.eventHub = new EventHub_1.EventHub();
  16170. _super.prototype.init.call(this);
  16171. };
  16172. ReplayWhiteboard.prototype.loadEvents = function () {
  16173. var _this = this;
  16174. if (this.onLoad && !this.loadingLock) {
  16175. this.loadingLock = true;
  16176. var startTime = this.recordStartTime + this.currentRelativeTime;
  16177. var endTime = startTime + windowSize;
  16178. this.onLoad(startTime, endTime).then(function (events) {
  16179. var _a;
  16180. _this.loadedRelativeTime = _this.currentRelativeTime;
  16181. (_a = _this.leftEvents).push.apply(_a, events || []);
  16182. }).finally(function () {
  16183. _this.loadingLock = false;
  16184. });
  16185. }
  16186. };
  16187. return ReplayWhiteboard;
  16188. }(MirrorWhiteboard_1.MirrorWhiteboard);
  16189. exports.ReplayWhiteboard = ReplayWhiteboard;
  16190. /***/ }),
  16191. /***/ "./src/whiteboard/WhitePage/index.less":
  16192. /*!*********************************************!*\
  16193. !*** ./src/whiteboard/WhitePage/index.less ***!
  16194. \*********************************************/
  16195. /*! no static exports found */
  16196. /***/ (function(module, exports, __webpack_require__) {
  16197. var content = __webpack_require__(/*! !../../../node_modules/css-loader/dist/cjs.js??ref--11-1!../../../node_modules/postcss-loader/src!../../../node_modules/less-loader/dist/cjs.js??ref--11-3!./index.less */ "./node_modules/css-loader/dist/cjs.js?!./node_modules/postcss-loader/src/index.js!./node_modules/less-loader/dist/cjs.js?!./src/whiteboard/WhitePage/index.less");
  16198. if(typeof content === 'string') content = [[module.i, content, '']];
  16199. var transform;
  16200. var insertInto;
  16201. var options = {"hmr":true}
  16202. options.transform = transform
  16203. options.insertInto = undefined;
  16204. var update = __webpack_require__(/*! ../../../node_modules/style-loader/lib/addStyles.js */ "./node_modules/style-loader/lib/addStyles.js")(content, options);
  16205. if(content.locals) module.exports = content.locals;
  16206. if(false) {}
  16207. /***/ }),
  16208. /***/ "./src/whiteboard/WhitePage/index.ts":
  16209. /*!*******************************************!*\
  16210. !*** ./src/whiteboard/WhitePage/index.ts ***!
  16211. \*******************************************/
  16212. /*! no static exports found */
  16213. /***/ (function(module, exports, __webpack_require__) {
  16214. "use strict";
  16215. Object.defineProperty(exports, "__esModule", { value: true });
  16216. var index_1 = __webpack_require__(/*! ./../../drawboard/Drawboard/index */ "./src/drawboard/Drawboard/index.ts");
  16217. var uuid_1 = __webpack_require__(/*! ../../utils/uuid */ "./src/utils/uuid.ts");
  16218. var types_1 = __webpack_require__(/*! ../../markers/types */ "./src/markers/types.ts");
  16219. var dom_1 = __webpack_require__(/*! ../../utils/dom */ "./src/utils/dom.ts");
  16220. __webpack_require__(/*! ./index.less */ "./src/whiteboard/WhitePage/index.less");
  16221. var prefix = 'fcw-page';
  16222. var WhitePage = function () {
  16223. function WhitePage(source, _a) {
  16224. var _b = _a === void 0 ? {} : _a,
  16225. mode = _b.mode,
  16226. whiteboard = _b.whiteboard,
  16227. parentContainer = _b.parentContainer,
  16228. extraToolbarItems = _b.extraToolbarItems;
  16229. this.id = uuid_1.uuid();
  16230. this.mode = 'master';
  16231. if (mode) {
  16232. this.mode = mode;
  16233. }
  16234. this.parentContainer = parentContainer;
  16235. this.whiteboard = whiteboard;
  16236. this.initSource(source);
  16237. if (this.mode === 'master') {
  16238. this.initMaster(extraToolbarItems);
  16239. }
  16240. if (this.mode === 'mirror') {
  16241. this.initMirror();
  16242. }
  16243. }
  16244. WhitePage.prototype.open = function () {
  16245. this.drawboard.open();
  16246. };
  16247. WhitePage.prototype.hide = function () {
  16248. this.drawboard.hide();
  16249. };
  16250. WhitePage.prototype.show = function () {
  16251. this.drawboard.show();
  16252. };
  16253. WhitePage.prototype.destroy = function () {
  16254. this.drawboard.destroy();
  16255. };
  16256. WhitePage.prototype.captureSnap = function () {
  16257. var markerSnaps = this.drawboard.markers.map(function (m) {
  16258. return m.captureSnap();
  16259. });
  16260. return {
  16261. id: this.id,
  16262. markers: markerSnaps
  16263. };
  16264. };
  16265. WhitePage.prototype.applySnap = function (snap) {
  16266. var _this = this;
  16267. var markerIdsSet = new Set();
  16268. snap.markers.forEach(function (markerSnap) {
  16269. var marker = _this.drawboard.markerMap[markerSnap.id];
  16270. markerIdsSet.add(markerSnap.id);
  16271. if (marker) {
  16272. marker.applySnap(markerSnap);
  16273. } else {
  16274. var newMarker = _this.drawboard.addMarker(types_1.getMarkerByType(markerSnap.type), {
  16275. id: markerSnap.id
  16276. });
  16277. newMarker.applySnap(markerSnap);
  16278. }
  16279. });
  16280. this.drawboard.markers.forEach(function (marker) {
  16281. if (!markerIdsSet.has(marker.id)) {
  16282. _this.drawboard.deleteMarkerWithEvent(marker);
  16283. }
  16284. });
  16285. };
  16286. WhitePage.prototype.initSource = function (source) {
  16287. if (typeof source.imgSrc === 'string' && !this.parentContainer) {
  16288. throw new Error('Invalid source, If you set image url, you must also set parentContainer');
  16289. }
  16290. this.source = source;
  16291. if (source.imgEle) {
  16292. this.target = source.imgEle;
  16293. }
  16294. if (typeof source.imgSrc === 'string') {
  16295. this.container = dom_1.createDivWithClassName(prefix, this.parentContainer);
  16296. this.container.id = this.id;
  16297. this.target = document.createElement('img');
  16298. this.target.src = source.imgSrc;
  16299. this.target.alt = 'Siema image';
  16300. this.container.appendChild(this.target);
  16301. }
  16302. };
  16303. WhitePage.prototype.initMaster = function (extraToolbarItems) {
  16304. var _this = this;
  16305. if (this.whiteboard) {
  16306. this.drawboard = new index_1.Drawboard({ imgEle: this.target }, {
  16307. extraToolbarItems: extraToolbarItems,
  16308. mountContainer: this.whiteboard.target,
  16309. page: this,
  16310. onChange: function (ev) {
  16311. return _this.whiteboard.emit(ev);
  16312. }
  16313. });
  16314. } else {
  16315. this.drawboard = new index_1.Drawboard({ imgEle: this.target }, { page: this, mountContainer: this.whiteboard.target });
  16316. }
  16317. };
  16318. WhitePage.prototype.initMirror = function () {
  16319. var _this = this;
  16320. if (!this.whiteboard) {
  16321. throw new Error('Invalid whiteboard');
  16322. }
  16323. this.drawboard = new index_1.Drawboard({ imgEle: this.target }, { page: this, mountContainer: this.whiteboard.target });
  16324. this.whiteboard.eventHub.on('sync', function (ev) {
  16325. try {
  16326. if (ev.target === 'page' && ev.id === _this.id) {
  16327. _this.onPageSync();
  16328. }
  16329. if (ev.target === 'marker') {
  16330. _this.onMarkerSync(ev);
  16331. }
  16332. } catch (e) {
  16333. console.warn(e);
  16334. }
  16335. });
  16336. };
  16337. WhitePage.prototype.onPageSync = function () {};
  16338. WhitePage.prototype.onMarkerSync = function (ev) {
  16339. if (!ev.marker) {
  16340. return;
  16341. }
  16342. var id = ev.id;
  16343. if (ev.event === 'addMarker' && ev.parentId === this.id) {
  16344. var marker = this.drawboard.markerMap[id];
  16345. if (!marker) {
  16346. this.drawboard.addMarker(types_1.getMarkerByType(ev.marker.type), {
  16347. id: ev.marker.id,
  16348. originX: ev.marker.dx,
  16349. originY: ev.marker.dy
  16350. });
  16351. }
  16352. }
  16353. if (!id) {
  16354. return;
  16355. }
  16356. if (ev.event === 'removeMarker') {
  16357. var marker = this.drawboard.markerMap[id];
  16358. if (marker) {
  16359. this.drawboard.deleteMarker(marker);
  16360. }
  16361. }
  16362. if (ev.event === 'moveMarker' || ev.event === 'resizeMarker') {
  16363. var marker = this.drawboard.markerMap[id];
  16364. if (marker) {
  16365. marker.reactToManipulation(ev.event, ev.marker);
  16366. }
  16367. }
  16368. if (ev.event === 'inputMarker') {
  16369. var marker = this.drawboard.markerMap[id];
  16370. if (marker) {
  16371. marker.setText(ev.marker.text);
  16372. }
  16373. }
  16374. };
  16375. return WhitePage;
  16376. }();
  16377. exports.WhitePage = WhitePage;
  16378. /***/ }),
  16379. /***/ "./src/whiteboard/Whiteboard/index.ts":
  16380. /*!********************************************!*\
  16381. !*** ./src/whiteboard/Whiteboard/index.ts ***!
  16382. \********************************************/
  16383. /*! no static exports found */
  16384. /***/ (function(module, exports, __webpack_require__) {
  16385. "use strict";
  16386. var __extends = this && this.__extends || function () {
  16387. var extendStatics = function (d, b) {
  16388. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) {
  16389. d.__proto__ = b;
  16390. } || function (d, b) {
  16391. for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
  16392. };
  16393. return extendStatics(d, b);
  16394. };
  16395. return function (d, b) {
  16396. extendStatics(d, b);
  16397. function __() {
  16398. this.constructor = d;
  16399. }
  16400. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  16401. };
  16402. }();
  16403. Object.defineProperty(exports, "__esModule", { value: true });
  16404. var index_1 = __webpack_require__(/*! ../WhitePage/index */ "./src/whiteboard/WhitePage/index.ts");
  16405. var dom_1 = __webpack_require__(/*! ../../utils/dom */ "./src/utils/dom.ts");
  16406. var index_2 = __webpack_require__(/*! ../AbstractWhiteboard/index */ "./src/whiteboard/AbstractWhiteboard/index.ts");
  16407. var toolbar_items_1 = __webpack_require__(/*! ../../toolbar/toolbar-items */ "./src/toolbar/toolbar-items.ts");
  16408. var LeftArrowIcon = __webpack_require__(/*! ../../assets/bx-left-arrow.svg */ "./src/assets/bx-left-arrow.svg");
  16409. var RightArrowIcon = __webpack_require__(/*! ../../assets/bx-right-arrow.svg */ "./src/assets/bx-right-arrow.svg");
  16410. var FinishIcon = __webpack_require__(/*! ../../assets/finish.svg */ "./src/assets/finish.svg");
  16411. var RollbackIcon = __webpack_require__(/*! ../../assets/rollback.svg */ "./src/assets/rollback.svg");
  16412. var prefix = 'fcw-board';
  16413. var Whiteboard = function (_super) {
  16414. __extends(Whiteboard, _super);
  16415. function Whiteboard() {
  16416. var _this = _super !== null && _super.apply(this, arguments) || this;
  16417. _this.mode = 'master';
  16418. return _this;
  16419. }
  16420. Whiteboard.prototype.destroy = function () {
  16421. _super.prototype.destroy.call(this);
  16422. };
  16423. Whiteboard.prototype.init = function () {
  16424. this.imgsContainer = dom_1.createDivWithClassName(prefix + "-imgs", this.target);
  16425. this.pagesContainer = dom_1.createDivWithClassName(prefix + "-pages", this.target);
  16426. this.initMaster();
  16427. this.snapHistory.push(this.captureSnap(false));
  16428. this.emitSnapshot();
  16429. };
  16430. Whiteboard.prototype.initMaster = function () {
  16431. var _this = this;
  16432. this.isInitialized = true;
  16433. var prevToolbarItem = {
  16434. icon: LeftArrowIcon,
  16435. name: 'prev-flip-arrow',
  16436. tooltipText: 'Prev',
  16437. onClick: function () {
  16438. var nextPageIndex = _this.visiblePageIndex - 1 < 0 ? _this.pages.length - 1 : _this.visiblePageIndex - 1;
  16439. document.querySelectorAll('.fc-whiteboard-indicator-current').forEach(function (e) {
  16440. e.innerHTML = "" + (nextPageIndex + 1);
  16441. });
  16442. _this.onPageChange(nextPageIndex);
  16443. }
  16444. };
  16445. var indicatorContainer = document.createElement('div');
  16446. indicatorContainer.className = 'fc-whiteboard-indicator-container';
  16447. var indicatorCurrent = document.createElement('span');
  16448. indicatorCurrent.className = 'fc-whiteboard-indicator-current';
  16449. indicatorCurrent.innerHTML = "" + (this.visiblePageIndex + 1);
  16450. indicatorContainer.appendChild(indicatorCurrent);
  16451. indicatorContainer.appendChild(document.createTextNode("/" + this.sources.length));
  16452. var indicatorItem = {
  16453. name: 'indicator',
  16454. onRender: function () {
  16455. return indicatorContainer;
  16456. }
  16457. };
  16458. var nextToolbarItem = {
  16459. icon: RightArrowIcon,
  16460. name: 'next-flip-arrow',
  16461. tooltipText: 'Next',
  16462. onClick: function () {
  16463. var nextPageIndex = _this.visiblePageIndex + 1 > _this.pages.length - 1 ? 0 : _this.visiblePageIndex + 1;
  16464. document.querySelectorAll('.fc-whiteboard-indicator-current').forEach(function (e) {
  16465. e.innerHTML = "" + (nextPageIndex + 1);
  16466. });
  16467. _this.onPageChange(nextPageIndex);
  16468. }
  16469. };
  16470. var finishItem = {
  16471. icon: FinishIcon,
  16472. name: 'finish',
  16473. tooltipText: 'Finish',
  16474. onClick: function () {
  16475. _this.emit({
  16476. event: 'finish',
  16477. id: _this.id,
  16478. target: 'whiteboard'
  16479. });
  16480. }
  16481. };
  16482. var rollbackItem = {
  16483. icon: RollbackIcon,
  16484. name: 'rollback',
  16485. tooltipText: 'Rollback',
  16486. shortcut: 'ESC',
  16487. onClick: function () {
  16488. _this.rollbackSnap();
  16489. }
  16490. };
  16491. this.sources.forEach(function (source) {
  16492. var page = new index_1.WhitePage({ imgSrc: source }, {
  16493. mode: _this.mode,
  16494. whiteboard: _this,
  16495. parentContainer: _this.pagesContainer,
  16496. extraToolbarItems: [toolbar_items_1.separatorToolbarItem, prevToolbarItem, indicatorItem, nextToolbarItem, toolbar_items_1.separatorToolbarItem, finishItem, rollbackItem]
  16497. });
  16498. page.container.style.visibility = 'hidden';
  16499. _this.pages.push(page);
  16500. });
  16501. this.initSiema();
  16502. };
  16503. Whiteboard.prototype.onPageChange = function (nextPageIndex) {
  16504. if (this.visiblePageIndex === nextPageIndex) {
  16505. return;
  16506. }
  16507. this.siema.goTo(nextPageIndex);
  16508. this.visiblePageIndex = nextPageIndex;
  16509. this.pages.forEach(function (page, i) {
  16510. if (nextPageIndex === i) {
  16511. page.show();
  16512. } else {
  16513. page.hide();
  16514. }
  16515. });
  16516. this.emit({
  16517. event: 'borderChangePage',
  16518. id: this.id,
  16519. target: 'whiteboard',
  16520. border: this.captureSnap()
  16521. });
  16522. };
  16523. Whiteboard.prototype.emitSnapshot = function () {
  16524. var _this = this;
  16525. var innerFunc = function () {
  16526. _this.emit({
  16527. event: 'borderSnap',
  16528. id: _this.id,
  16529. target: 'whiteboard',
  16530. border: _this.captureSnap(false)
  16531. });
  16532. };
  16533. this.emitInterval = setInterval(function () {
  16534. innerFunc();
  16535. }, this.snapInterval);
  16536. setTimeout(innerFunc, 500);
  16537. };
  16538. return Whiteboard;
  16539. }(index_2.AbstractWhiteboard);
  16540. exports.Whiteboard = Whiteboard;
  16541. /***/ })
  16542. /******/ });
  16543. });
  16544. //# sourceMappingURL=index.js.map