acf-pro-blocks.js 148 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846
  1. /******/ (function() { // webpackBootstrap
  2. /******/ var __webpack_modules__ = ({
  3. /***/ "./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-blocks.js":
  4. /*!*************************************************************************!*\
  5. !*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-blocks.js ***!
  6. \*************************************************************************/
  7. /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
  8. "use strict";
  9. __webpack_require__.r(__webpack_exports__);
  10. /* harmony import */ var _babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/defineProperty */ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js");
  11. /* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "./node_modules/react/index.js");
  12. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
  13. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0,_babel_runtime_helpers_defineProperty__WEBPACK_IMPORTED_MODULE_0__["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
  14. const md5 = __webpack_require__(/*! md5 */ "./node_modules/md5/md5.js");
  15. (($, undefined) => {
  16. // Dependencies.
  17. const {
  18. BlockControls,
  19. InspectorControls,
  20. InnerBlocks,
  21. useBlockProps,
  22. AlignmentToolbar,
  23. BlockVerticalAlignmentToolbar
  24. } = wp.blockEditor;
  25. const {
  26. ToolbarGroup,
  27. ToolbarButton,
  28. Placeholder,
  29. Spinner
  30. } = wp.components;
  31. const {
  32. Fragment
  33. } = wp.element;
  34. const {
  35. Component
  36. } = React;
  37. const {
  38. withSelect
  39. } = wp.data;
  40. const {
  41. createHigherOrderComponent
  42. } = wp.compose;
  43. // Potentially experimental dependencies.
  44. const BlockAlignmentMatrixToolbar = wp.blockEditor.__experimentalBlockAlignmentMatrixToolbar || wp.blockEditor.BlockAlignmentMatrixToolbar;
  45. // Gutenberg v10.x begins transition from Toolbar components to Control components.
  46. const BlockAlignmentMatrixControl = wp.blockEditor.__experimentalBlockAlignmentMatrixControl || wp.blockEditor.BlockAlignmentMatrixControl;
  47. const BlockFullHeightAlignmentControl = wp.blockEditor.__experimentalBlockFullHeightAligmentControl || wp.blockEditor.__experimentalBlockFullHeightAlignmentControl || wp.blockEditor.BlockFullHeightAlignmentControl;
  48. const useInnerBlocksProps = wp.blockEditor.__experimentalUseInnerBlocksProps || wp.blockEditor.useInnerBlocksProps;
  49. /**
  50. * Storage for registered block types.
  51. *
  52. * @since 5.8.0
  53. * @var object
  54. */
  55. const blockTypes = {};
  56. /**
  57. * Returns a block type for the given name.
  58. *
  59. * @date 20/2/19
  60. * @since 5.8.0
  61. *
  62. * @param string name The block name.
  63. * @return (object|false)
  64. */
  65. function getBlockType(name) {
  66. return blockTypes[name] || false;
  67. }
  68. /**
  69. * Returns a block version for a given block name
  70. *
  71. * @date 8/6/22
  72. * @since 6.0
  73. *
  74. * @param string name The block name
  75. * @return int
  76. */
  77. function getBlockVersion(name) {
  78. const blockType = getBlockType(name);
  79. return blockType.acf_block_version || 1;
  80. }
  81. /**
  82. * Returns true if a block (identified by client ID) is nested in a query loop block.
  83. *
  84. * @date 17/1/22
  85. * @since 5.12
  86. *
  87. * @param {string} clientId A block client ID
  88. * @return boolean
  89. */
  90. function isBlockInQueryLoop(clientId) {
  91. const parents = wp.data.select('core/block-editor').getBlockParents(clientId);
  92. const parentsData = wp.data.select('core/block-editor').getBlocksByClientId(parents);
  93. return parentsData.filter(block => block.name === 'core/query').length;
  94. }
  95. /**
  96. * Returns true if we're currently inside the WP 5.9+ site editor.
  97. *
  98. * @date 08/02/22
  99. * @since 5.12
  100. *
  101. * @return boolean
  102. */
  103. function isSiteEditor() {
  104. return typeof pagenow === 'string' && pagenow === 'site-editor';
  105. }
  106. /**
  107. * Returns true if the block editor is currently showing the desktop device type preview.
  108. *
  109. * This function will always return true in the site editor as it uses the
  110. * edit-post store rather than the edit-site store.
  111. *
  112. * @date 15/02/22
  113. * @since 5.12
  114. *
  115. * @return boolean
  116. */
  117. function isDesktopPreviewDeviceType() {
  118. const editPostStore = select('core/edit-post');
  119. // Return true if the edit post store isn't available (such as in the widget editor)
  120. if (!editPostStore) return true;
  121. // Check if function exists (experimental or not) and return true if it's Desktop, or doesn't exist.
  122. if (editPostStore.__experimentalGetPreviewDeviceType) {
  123. return 'Desktop' === editPostStore.__experimentalGetPreviewDeviceType();
  124. } else if (editPostStore.getPreviewDeviceType) {
  125. return 'Desktop' === editPostStore.getPreviewDeviceType();
  126. } else {
  127. return true;
  128. }
  129. }
  130. /**
  131. * Returns true if the block editor is currently in template edit mode.
  132. *
  133. * @date 16/02/22
  134. * @since 5.12
  135. *
  136. * @return boolean
  137. */
  138. function isEditingTemplate() {
  139. const editPostStore = select('core/edit-post');
  140. // Return false if the edit post store isn't available (such as in the widget editor)
  141. if (!editPostStore) return false;
  142. // Return false if the function doesn't exist
  143. if (!editPostStore.isEditingTemplate) return false;
  144. return editPostStore.isEditingTemplate();
  145. }
  146. /**
  147. * Returns true if we're currently inside an iFramed non-desktop device preview type (WP5.9+)
  148. *
  149. * @date 15/02/22
  150. * @since 5.12
  151. *
  152. * @return boolean
  153. */
  154. function isiFramedMobileDevicePreview() {
  155. return $('iframe[name=editor-canvas]').length && !isDesktopPreviewDeviceType();
  156. }
  157. /**
  158. * Registers a block type.
  159. *
  160. * @date 19/2/19
  161. * @since 5.8.0
  162. *
  163. * @param object blockType The block type settings localized from PHP.
  164. * @return object The result from wp.blocks.registerBlockType().
  165. */
  166. function registerBlockType(blockType) {
  167. // Bail early if is excluded post_type.
  168. const allowedTypes = blockType.post_types || [];
  169. if (allowedTypes.length) {
  170. // Always allow block to appear on "Edit reusable Block" screen.
  171. allowedTypes.push('wp_block');
  172. // Check post type.
  173. const postType = acf.get('postType');
  174. if (!allowedTypes.includes(postType)) {
  175. return false;
  176. }
  177. }
  178. // Handle svg HTML.
  179. if (typeof blockType.icon === 'string' && blockType.icon.substr(0, 4) === '<svg') {
  180. const iconHTML = blockType.icon;
  181. blockType.icon = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Div, null, iconHTML);
  182. }
  183. // Remove icon if empty to allow for default "block".
  184. // Avoids JS error preventing block from being registered.
  185. if (!blockType.icon) {
  186. delete blockType.icon;
  187. }
  188. // Check category exists and fallback to "common".
  189. const category = wp.blocks.getCategories().filter(_ref => {
  190. let {
  191. slug
  192. } = _ref;
  193. return slug === blockType.category;
  194. }).pop();
  195. if (!category) {
  196. //console.warn( `The block "${blockType.name}" is registered with an unknown category "${blockType.category}".` );
  197. blockType.category = 'common';
  198. }
  199. // Merge in block settings before local additions.
  200. blockType = acf.parseArgs(blockType, {
  201. title: '',
  202. name: '',
  203. category: '',
  204. api_version: 2,
  205. acf_block_version: 1
  206. });
  207. // Remove all empty attribute defaults from PHP values to allow serialisation.
  208. // https://github.com/WordPress/gutenberg/issues/7342
  209. for (const key in blockType.attributes) {
  210. if (blockType.attributes[key].default.length === 0) {
  211. delete blockType.attributes[key].default;
  212. }
  213. }
  214. // Apply anchor supports to avoid block editor default writing to ID.
  215. if (blockType.supports.anchor) {
  216. blockType.attributes.anchor = {
  217. type: 'string'
  218. };
  219. }
  220. // Append edit and save functions.
  221. let ThisBlockEdit = BlockEdit;
  222. let ThisBlockSave = BlockSave;
  223. // Apply alignText functionality.
  224. if (blockType.supports.alignText || blockType.supports.align_text) {
  225. blockType.attributes = addBackCompatAttribute(blockType.attributes, 'align_text', 'string');
  226. ThisBlockEdit = withAlignTextComponent(ThisBlockEdit, blockType);
  227. }
  228. // Apply alignContent functionality.
  229. if (blockType.supports.alignContent || blockType.supports.align_content) {
  230. blockType.attributes = addBackCompatAttribute(blockType.attributes, 'align_content', 'string');
  231. ThisBlockEdit = withAlignContentComponent(ThisBlockEdit, blockType);
  232. }
  233. // Apply fullHeight functionality.
  234. if (blockType.supports.fullHeight || blockType.supports.full_height) {
  235. blockType.attributes = addBackCompatAttribute(blockType.attributes, 'full_height', 'boolean');
  236. ThisBlockEdit = withFullHeightComponent(ThisBlockEdit, blockType.blockType);
  237. }
  238. // Set edit and save functions.
  239. blockType.edit = props => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(ThisBlockEdit, props);
  240. blockType.save = () => (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(ThisBlockSave, null);
  241. // Add to storage.
  242. blockTypes[blockType.name] = blockType;
  243. // Register with WP.
  244. const result = wp.blocks.registerBlockType(blockType.name, blockType);
  245. // Fix bug in 'core/anchor/attribute' filter overwriting attribute.
  246. // Required for < WP5.9
  247. // See https://github.com/WordPress/gutenberg/issues/15240
  248. if (result.attributes.anchor) {
  249. result.attributes.anchor = {
  250. type: 'string'
  251. };
  252. }
  253. // Return result.
  254. return result;
  255. }
  256. /**
  257. * Returns the wp.data.select() response with backwards compatibility.
  258. *
  259. * @date 17/06/2020
  260. * @since 5.9.0
  261. *
  262. * @param string selector The selector name.
  263. * @return mixed
  264. */
  265. function select(selector) {
  266. if (selector === 'core/block-editor') {
  267. return wp.data.select('core/block-editor') || wp.data.select('core/editor');
  268. }
  269. return wp.data.select(selector);
  270. }
  271. /**
  272. * Returns the wp.data.dispatch() response with backwards compatibility.
  273. *
  274. * @date 17/06/2020
  275. * @since 5.9.0
  276. *
  277. * @param string selector The selector name.
  278. * @return mixed
  279. */
  280. function dispatch(selector) {
  281. return wp.data.dispatch(selector);
  282. }
  283. /**
  284. * Returns an array of all blocks for the given args.
  285. *
  286. * @date 27/2/19
  287. * @since 5.7.13
  288. *
  289. * @param {object} args An object of key=>value pairs used to filter results.
  290. * @return array.
  291. */
  292. function getBlocks(args) {
  293. let blocks = [];
  294. // Local function to recurse through all child blocks and add to the blocks array.
  295. const recurseBlocks = block => {
  296. blocks.push(block);
  297. select('core/block-editor').getBlocks(block.clientId).forEach(recurseBlocks);
  298. };
  299. // Trigger initial recursion for parent level blocks.
  300. select('core/block-editor').getBlocks().forEach(recurseBlocks);
  301. // Loop over args and filter.
  302. for (const k in args) {
  303. blocks = blocks.filter(_ref2 => {
  304. let {
  305. attributes
  306. } = _ref2;
  307. return attributes[k] === args[k];
  308. });
  309. }
  310. // Return results.
  311. return blocks;
  312. }
  313. /**
  314. * Storage for the AJAX queue.
  315. *
  316. * @const {array}
  317. */
  318. const ajaxQueue = {};
  319. /**
  320. * Storage for cached AJAX requests for block content.
  321. *
  322. * @since 5.12
  323. * @const {array}
  324. */
  325. const fetchCache = {};
  326. /**
  327. * Fetches a JSON result from the AJAX API.
  328. *
  329. * @date 28/2/19
  330. * @since 5.7.13
  331. *
  332. * @param object block The block props.
  333. * @query object The query args used in AJAX callback.
  334. * @return object The AJAX promise.
  335. */
  336. function fetchBlock(args) {
  337. const {
  338. attributes = {},
  339. context = {},
  340. query = {},
  341. clientId = null,
  342. delay = 0
  343. } = args;
  344. // Build a unique queue ID from block data, including the clientId for edit forms.
  345. const queueId = md5(JSON.stringify(_objectSpread(_objectSpread(_objectSpread({}, attributes), context), query)));
  346. const data = ajaxQueue[queueId] || {
  347. query: {},
  348. timeout: false,
  349. promise: $.Deferred(),
  350. started: false
  351. };
  352. // Append query args to storage.
  353. data.query = _objectSpread(_objectSpread({}, data.query), query);
  354. if (data.started) return data.promise;
  355. // Set fresh timeout.
  356. clearTimeout(data.timeout);
  357. data.timeout = setTimeout(() => {
  358. data.started = true;
  359. if (fetchCache[queueId]) {
  360. ajaxQueue[queueId] = null;
  361. data.promise.resolve.apply(fetchCache[queueId][0], fetchCache[queueId][1]);
  362. } else {
  363. $.ajax({
  364. url: acf.get('ajaxurl'),
  365. dataType: 'json',
  366. type: 'post',
  367. cache: false,
  368. data: acf.prepareForAjax({
  369. action: 'acf/ajax/fetch-block',
  370. block: JSON.stringify(attributes),
  371. clientId: clientId,
  372. context: JSON.stringify(context),
  373. query: data.query
  374. })
  375. }).always(() => {
  376. // Clean up queue after AJAX request is complete.
  377. ajaxQueue[queueId] = null;
  378. }).done(function () {
  379. fetchCache[queueId] = [this, arguments];
  380. data.promise.resolve.apply(this, arguments);
  381. }).fail(function () {
  382. data.promise.reject.apply(this, arguments);
  383. });
  384. }
  385. }, delay);
  386. // Update storage.
  387. ajaxQueue[queueId] = data;
  388. // Return promise.
  389. return data.promise;
  390. }
  391. /**
  392. * Returns true if both object are the same.
  393. *
  394. * @date 19/05/2020
  395. * @since 5.9.0
  396. *
  397. * @param object obj1
  398. * @param object obj2
  399. * @return bool
  400. */
  401. function compareObjects(obj1, obj2) {
  402. return JSON.stringify(obj1) === JSON.stringify(obj2);
  403. }
  404. /**
  405. * Converts HTML into a React element.
  406. *
  407. * @date 19/05/2020
  408. * @since 5.9.0
  409. *
  410. * @param string html The HTML to convert.
  411. * @param int acfBlockVersion The ACF block version number.
  412. * @return object Result of React.createElement().
  413. */
  414. acf.parseJSX = (html, acfBlockVersion) => {
  415. // Apply a temporary wrapper for the jQuery parse to prevent text nodes triggering errors.
  416. html = '<div>' + html + '</div>';
  417. // Correctly balance InnerBlocks tags for jQuery's initial parse.
  418. html = html.replace(/<InnerBlocks([^>]+)?\/>/, '<InnerBlocks$1></InnerBlocks>');
  419. return parseNode($(html)[0], acfBlockVersion, 0).props.children;
  420. };
  421. /**
  422. * Converts a DOM node into a React element.
  423. *
  424. * @date 19/05/2020
  425. * @since 5.9.0
  426. *
  427. * @param DOM node The DOM node.
  428. * @param int acfBlockVersion The ACF block version number.
  429. * @param int level The recursion level.
  430. * @return object Result of React.createElement().
  431. */
  432. function parseNode(node, acfBlockVersion) {
  433. let level = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
  434. // Get node name.
  435. const nodeName = parseNodeName(node.nodeName.toLowerCase(), acfBlockVersion);
  436. if (!nodeName) {
  437. return null;
  438. }
  439. // Get node attributes in React friendly format.
  440. const nodeAttrs = {};
  441. if (level === 1 && nodeName !== 'ACFInnerBlocks') {
  442. // Top level (after stripping away the container div), create a ref for passing through to ACF's JS API.
  443. nodeAttrs.ref = React.createRef();
  444. }
  445. acf.arrayArgs(node.attributes).map(parseNodeAttr).forEach(_ref3 => {
  446. let {
  447. name,
  448. value
  449. } = _ref3;
  450. nodeAttrs[name] = value;
  451. });
  452. if ('ACFInnerBlocks' === nodeName) {
  453. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(ACFInnerBlocks, nodeAttrs);
  454. }
  455. // Define args for React.createElement().
  456. const args = [nodeName, nodeAttrs];
  457. acf.arrayArgs(node.childNodes).forEach(child => {
  458. if (child instanceof Text) {
  459. const text = child.textContent;
  460. if (text) {
  461. args.push(text);
  462. }
  463. } else {
  464. args.push(parseNode(child, acfBlockVersion, level + 1));
  465. }
  466. });
  467. // Return element.
  468. return React.createElement.apply(this, args);
  469. }
  470. /**
  471. * Converts a node or attribute name into it's JSX compliant name
  472. *
  473. * @date 05/07/2021
  474. * @since 5.9.8
  475. *
  476. * @param string name The node or attribute name.
  477. * @return string
  478. */
  479. function getJSXName(name) {
  480. const replacement = acf.isget(acf, 'jsxNameReplacements', name);
  481. if (replacement) return replacement;
  482. return name;
  483. }
  484. /**
  485. * Converts the given name into a React friendly name or component.
  486. *
  487. * @date 19/05/2020
  488. * @since 5.9.0
  489. *
  490. * @param string name The node name in lowercase.
  491. * @param int acfBlockVersion The ACF block version number.
  492. * @return mixed
  493. */
  494. function parseNodeName(name, acfBlockVersion) {
  495. switch (name) {
  496. case 'innerblocks':
  497. if (acfBlockVersion < 2) {
  498. return InnerBlocks;
  499. }
  500. return 'ACFInnerBlocks';
  501. case 'script':
  502. return Script;
  503. case '#comment':
  504. return null;
  505. default:
  506. // Replace names for JSX counterparts.
  507. name = getJSXName(name);
  508. }
  509. return name;
  510. }
  511. /**
  512. * Functional component for ACFInnerBlocks.
  513. *
  514. * @since 6.0.0
  515. *
  516. * @param obj props element properties.
  517. * @return DOM element
  518. */
  519. function ACFInnerBlocks(props) {
  520. const {
  521. className = 'acf-innerblocks-container'
  522. } = props;
  523. const innerBlockProps = useInnerBlocksProps({
  524. className: className
  525. }, props);
  526. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", innerBlockProps, innerBlockProps.children);
  527. }
  528. /**
  529. * Converts the given attribute into a React friendly name and value object.
  530. *
  531. * @date 19/05/2020
  532. * @since 5.9.0
  533. *
  534. * @param obj nodeAttr The node attribute.
  535. * @return obj
  536. */
  537. function parseNodeAttr(nodeAttr) {
  538. let name = nodeAttr.name;
  539. let value = nodeAttr.value;
  540. switch (name) {
  541. // Class.
  542. case 'class':
  543. name = 'className';
  544. break;
  545. // Style.
  546. case 'style':
  547. const css = {};
  548. value.split(';').forEach(s => {
  549. const pos = s.indexOf(':');
  550. if (pos > 0) {
  551. let ruleName = s.substr(0, pos).trim();
  552. const ruleValue = s.substr(pos + 1).trim();
  553. // Rename core properties, but not CSS variables.
  554. if (ruleName.charAt(0) !== '-') {
  555. ruleName = acf.strCamelCase(ruleName);
  556. }
  557. css[ruleName] = ruleValue;
  558. }
  559. });
  560. value = css;
  561. break;
  562. // Default.
  563. default:
  564. // No formatting needed for "data-x" attributes.
  565. if (name.indexOf('data-') === 0) {
  566. break;
  567. }
  568. // Replace names for JSX counterparts.
  569. name = getJSXName(name);
  570. // Convert JSON values.
  571. const c1 = value.charAt(0);
  572. if (c1 === '[' || c1 === '{') {
  573. value = JSON.parse(value);
  574. }
  575. // Convert bool values.
  576. if (value === 'true' || value === 'false') {
  577. value = value === 'true';
  578. }
  579. break;
  580. }
  581. return {
  582. name,
  583. value
  584. };
  585. }
  586. /**
  587. * Higher Order Component used to set default block attribute values.
  588. *
  589. * By modifying block attributes directly, instead of defining defaults in registerBlockType(),
  590. * WordPress will include them always within the saved block serialized JSON.
  591. *
  592. * @date 31/07/2020
  593. * @since 5.9.0
  594. *
  595. * @param Component BlockListBlock The BlockListBlock Component.
  596. * @return Component
  597. */
  598. const withDefaultAttributes = createHigherOrderComponent(BlockListBlock => class WrappedBlockEdit extends Component {
  599. constructor(props) {
  600. super(props);
  601. // Extract vars.
  602. const {
  603. name,
  604. attributes
  605. } = this.props;
  606. // Only run on ACF Blocks.
  607. const blockType = getBlockType(name);
  608. if (!blockType) {
  609. return;
  610. }
  611. // Check and remove any empty string attributes to match PHP behaviour.
  612. Object.keys(attributes).forEach(key => {
  613. if (attributes[key] === '') {
  614. delete attributes[key];
  615. }
  616. });
  617. // Backward compatibility attribute replacement.
  618. const upgrades = {
  619. full_height: 'fullHeight',
  620. align_content: 'alignContent',
  621. align_text: 'alignText'
  622. };
  623. Object.keys(upgrades).forEach(key => {
  624. if (attributes[key] !== undefined) {
  625. attributes[upgrades[key]] = attributes[key];
  626. } else if (attributes[upgrades[key]] === undefined) {
  627. //Check for a default
  628. if (blockType[key] !== undefined) {
  629. attributes[upgrades[key]] = blockType[key];
  630. }
  631. }
  632. delete blockType[key];
  633. delete attributes[key];
  634. });
  635. // Set default attributes for those undefined.
  636. for (let attribute in blockType.attributes) {
  637. if (attributes[attribute] === undefined && blockType[attribute] !== undefined) {
  638. attributes[attribute] = blockType[attribute];
  639. }
  640. }
  641. }
  642. render() {
  643. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockListBlock, this.props);
  644. }
  645. }, 'withDefaultAttributes');
  646. wp.hooks.addFilter('editor.BlockListBlock', 'acf/with-default-attributes', withDefaultAttributes);
  647. /**
  648. * The BlockSave functional component.
  649. *
  650. * @date 08/07/2020
  651. * @since 5.9.0
  652. */
  653. function BlockSave() {
  654. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(InnerBlocks.Content, null);
  655. }
  656. /**
  657. * The BlockEdit component.
  658. *
  659. * @date 19/2/19
  660. * @since 5.7.12
  661. */
  662. class BlockEdit extends Component {
  663. constructor(props) {
  664. super(props);
  665. this.setup();
  666. }
  667. setup() {
  668. const {
  669. name,
  670. attributes,
  671. clientId
  672. } = this.props;
  673. const blockType = getBlockType(name);
  674. // Restrict current mode.
  675. function restrictMode(modes) {
  676. if (!modes.includes(attributes.mode)) {
  677. attributes.mode = modes[0];
  678. }
  679. }
  680. if (isBlockInQueryLoop(clientId) || isSiteEditor() || isiFramedMobileDevicePreview() || isEditingTemplate()) {
  681. restrictMode(['preview']);
  682. } else {
  683. switch (blockType.mode) {
  684. case 'edit':
  685. restrictMode(['edit', 'preview']);
  686. break;
  687. case 'preview':
  688. restrictMode(['preview', 'edit']);
  689. break;
  690. default:
  691. restrictMode(['auto']);
  692. break;
  693. }
  694. }
  695. }
  696. render() {
  697. const {
  698. name,
  699. attributes,
  700. setAttributes,
  701. clientId
  702. } = this.props;
  703. const blockType = getBlockType(name);
  704. const forcePreview = isBlockInQueryLoop(clientId) || isSiteEditor() || isiFramedMobileDevicePreview() || isEditingTemplate();
  705. let {
  706. mode
  707. } = attributes;
  708. if (forcePreview) {
  709. mode = 'preview';
  710. }
  711. // Show toggle only for edit/preview modes and for blocks not in a query loop/FSE.
  712. let showToggle = blockType.supports.mode;
  713. if (mode === 'auto' || forcePreview) {
  714. showToggle = false;
  715. }
  716. // Configure toggle variables.
  717. const toggleText = mode === 'preview' ? acf.__('Switch to Edit') : acf.__('Switch to Preview');
  718. const toggleIcon = mode === 'preview' ? 'edit' : 'welcome-view-site';
  719. function toggleMode() {
  720. setAttributes({
  721. mode: mode === 'preview' ? 'edit' : 'preview'
  722. });
  723. }
  724. // Return template.
  725. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockControls, null, showToggle && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(ToolbarGroup, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(ToolbarButton, {
  726. className: "components-icon-button components-toolbar__control",
  727. label: toggleText,
  728. icon: toggleIcon,
  729. onClick: toggleMode
  730. }))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(InspectorControls, null, mode === 'preview' && (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
  731. className: "acf-block-component acf-block-panel"
  732. }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, this.props))), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockBody, this.props));
  733. }
  734. }
  735. /**
  736. * The BlockBody functional component.
  737. *
  738. * @date 19/2/19
  739. * @since 5.7.12
  740. */
  741. function _BlockBody(props) {
  742. const {
  743. attributes,
  744. isSelected,
  745. name
  746. } = props;
  747. const {
  748. mode
  749. } = attributes;
  750. let showForm = true;
  751. let additionalClasses = 'acf-block-component acf-block-body';
  752. if (mode === 'auto' && !isSelected || mode === 'preview') {
  753. additionalClasses += ' acf-block-preview';
  754. showForm = false;
  755. }
  756. if (getBlockVersion(name) > 1) {
  757. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", useBlockProps({
  758. className: additionalClasses
  759. }), showForm ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, props) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockPreview, props));
  760. } else {
  761. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", useBlockProps(), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
  762. className: "acf-block-component acf-block-body"
  763. }, showForm ? (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockForm, props) : (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockPreview, props)));
  764. }
  765. }
  766. // Append blockIndex to component props.
  767. const BlockBody = withSelect((select, ownProps) => {
  768. const {
  769. clientId
  770. } = ownProps;
  771. // Use optional rootClientId to allow discoverability of child blocks.
  772. const rootClientId = select('core/block-editor').getBlockRootClientId(clientId);
  773. const index = select('core/block-editor').getBlockIndex(clientId, rootClientId);
  774. return {
  775. index
  776. };
  777. })(_BlockBody);
  778. /**
  779. * A react component to append HTMl.
  780. *
  781. * @date 19/2/19
  782. * @since 5.7.12
  783. *
  784. * @param string children The html to insert.
  785. * @return void
  786. */
  787. class Div extends Component {
  788. render() {
  789. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
  790. dangerouslySetInnerHTML: {
  791. __html: this.props.children
  792. }
  793. });
  794. }
  795. }
  796. /**
  797. * A react Component for inline scripts.
  798. *
  799. * This Component uses a combination of React references and jQuery to append the
  800. * inline <script> HTML each time the component is rendered.
  801. *
  802. * @date 29/05/2020
  803. * @since 5.9.0
  804. *
  805. * @param type Var Description.
  806. * @return type Description.
  807. */
  808. class Script extends Component {
  809. render() {
  810. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
  811. ref: el => this.el = el
  812. });
  813. }
  814. setHTML(html) {
  815. $(this.el).html(`<script>${html}</script>`);
  816. }
  817. componentDidUpdate() {
  818. this.setHTML(this.props.children);
  819. }
  820. componentDidMount() {
  821. this.setHTML(this.props.children);
  822. }
  823. }
  824. // Data storage for DynamicHTML components.
  825. const store = {};
  826. /**
  827. * DynamicHTML Class.
  828. *
  829. * A react componenet to load and insert dynamic HTML.
  830. *
  831. * @date 19/2/19
  832. * @since 5.7.12
  833. *
  834. * @param void
  835. * @return void
  836. */
  837. class DynamicHTML extends Component {
  838. constructor(props) {
  839. super(props);
  840. // Bind callbacks.
  841. this.setRef = this.setRef.bind(this);
  842. // Define default props and call setup().
  843. this.id = '';
  844. this.el = false;
  845. this.subscribed = true;
  846. this.renderMethod = 'jQuery';
  847. this.setup(props);
  848. // Load state.
  849. this.loadState();
  850. }
  851. setup(props) {
  852. // Do nothing.
  853. }
  854. fetch() {
  855. // Do nothing.
  856. }
  857. maybePreload(blockId, clientId, form) {
  858. if (this.state.html === undefined && !isBlockInQueryLoop(this.props.clientId)) {
  859. const preloadedBlocks = acf.get('preloadedBlocks');
  860. const modeText = form ? 'form' : 'preview';
  861. if (preloadedBlocks && preloadedBlocks[blockId]) {
  862. // Ensure we only preload the correct block state (form or preview).
  863. if (form && !preloadedBlocks[blockId].form || !form && preloadedBlocks[blockId].form) return false;
  864. // Set HTML to the preloaded version.
  865. return preloadedBlocks[blockId].html.replaceAll(blockId, clientId);
  866. }
  867. }
  868. return false;
  869. }
  870. loadState() {
  871. this.state = store[this.id] || {};
  872. }
  873. setState(state) {
  874. store[this.id] = _objectSpread(_objectSpread({}, this.state), state);
  875. // Update component state if subscribed.
  876. // - Allows AJAX callback to update store without modifying state of an unmounted component.
  877. if (this.subscribed) {
  878. super.setState(state);
  879. }
  880. }
  881. setHtml(html) {
  882. html = html ? html.trim() : '';
  883. // Bail early if html has not changed.
  884. if (html === this.state.html) {
  885. return;
  886. }
  887. // Update state.
  888. const state = {
  889. html
  890. };
  891. if (this.renderMethod === 'jsx') {
  892. state.jsx = acf.parseJSX(html, getBlockVersion(this.props.name));
  893. // Handle templates which don't contain any valid JSX parsable elements.
  894. if (!state.jsx) {
  895. console.warn('Your ACF block template contains no valid HTML elements. Appending a empty div to prevent React JS errors.');
  896. state.html += '<div></div>';
  897. state.jsx = acf.parseJSX(state.html, getBlockVersion(this.props.name));
  898. }
  899. // If we've got an object (as an array) find the first valid React ref.
  900. if (Array.isArray(state.jsx)) {
  901. let refElement = state.jsx.find(element => React.isValidElement(element));
  902. state.ref = refElement.ref;
  903. } else {
  904. state.ref = state.jsx.ref;
  905. }
  906. state.$el = $(this.el);
  907. } else {
  908. state.$el = $(html);
  909. }
  910. this.setState(state);
  911. }
  912. setRef(el) {
  913. this.el = el;
  914. }
  915. render() {
  916. // Render JSX.
  917. if (this.state.jsx) {
  918. // If we're a v2+ block, use the jsx element itself as our ref.
  919. if (getBlockVersion(this.props.name) > 1) {
  920. this.setRef(this.state.jsx);
  921. return this.state.jsx;
  922. } else {
  923. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
  924. ref: this.setRef
  925. }, this.state.jsx);
  926. }
  927. }
  928. // Return HTML.
  929. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)("div", {
  930. ref: this.setRef
  931. }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Placeholder, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Spinner, null)));
  932. }
  933. shouldComponentUpdate(_ref4, _ref5) {
  934. let {
  935. index
  936. } = _ref4;
  937. let {
  938. html
  939. } = _ref5;
  940. if (index !== this.props.index) {
  941. this.componentWillMove();
  942. }
  943. return html !== this.state.html;
  944. }
  945. display(context) {
  946. // This method is called after setting new HTML and the Component render.
  947. // The jQuery render method simply needs to move $el into place.
  948. if (this.renderMethod === 'jQuery') {
  949. const $el = this.state.$el;
  950. const $prevParent = $el.parent();
  951. const $thisParent = $(this.el);
  952. // Move $el into place.
  953. $thisParent.html($el);
  954. // Special case for reusable blocks.
  955. // Multiple instances of the same reusable block share the same block id.
  956. // This causes all instances to share the same state (cool), which unfortunately
  957. // pulls $el back and forth between the last rendered reusable block.
  958. // This simple fix leaves a "clone" behind :)
  959. if ($prevParent.length && $prevParent[0] !== $thisParent[0]) {
  960. $prevParent.html($el.clone());
  961. }
  962. }
  963. // Call context specific method.
  964. switch (context) {
  965. case 'append':
  966. this.componentDidAppend();
  967. break;
  968. case 'remount':
  969. this.componentDidRemount();
  970. break;
  971. }
  972. }
  973. componentDidMount() {
  974. // Fetch on first load.
  975. if (this.state.html === undefined) {
  976. this.fetch();
  977. // Or remount existing HTML.
  978. } else {
  979. this.display('remount');
  980. }
  981. }
  982. componentDidUpdate(prevProps, prevState) {
  983. // HTML has changed.
  984. this.display('append');
  985. }
  986. componentDidAppend() {
  987. acf.doAction('append', this.state.$el);
  988. }
  989. componentWillUnmount() {
  990. acf.doAction('unmount', this.state.$el);
  991. // Unsubscribe this component from state.
  992. this.subscribed = false;
  993. }
  994. componentDidRemount() {
  995. this.subscribed = true;
  996. // Use setTimeout to avoid incorrect timing of events.
  997. // React will unmount and mount components in DOM order.
  998. // This means a new component can be mounted before an old one is unmounted.
  999. // ACF shares $el across new/old components which is un-React-like.
  1000. // This timout ensures that unmounting occurs before remounting.
  1001. setTimeout(() => {
  1002. acf.doAction('remount', this.state.$el);
  1003. });
  1004. }
  1005. componentWillMove() {
  1006. acf.doAction('unmount', this.state.$el);
  1007. setTimeout(() => {
  1008. acf.doAction('remount', this.state.$el);
  1009. });
  1010. }
  1011. }
  1012. /**
  1013. * BlockForm Class.
  1014. *
  1015. * A react componenet to handle the block form.
  1016. *
  1017. * @date 19/2/19
  1018. * @since 5.7.12
  1019. *
  1020. * @param string id the block id.
  1021. * @return void
  1022. */
  1023. class BlockForm extends DynamicHTML {
  1024. setup(_ref6) {
  1025. let {
  1026. clientId
  1027. } = _ref6;
  1028. this.id = `BlockForm-${clientId}`;
  1029. }
  1030. fetch() {
  1031. // Extract props.
  1032. const {
  1033. attributes,
  1034. context,
  1035. clientId
  1036. } = this.props;
  1037. const hash = createBlockAttributesHash(attributes, context);
  1038. // Try preloaded data first.
  1039. const preloaded = this.maybePreload(hash, clientId, true);
  1040. if (preloaded) {
  1041. this.setHtml(preloaded);
  1042. return;
  1043. }
  1044. // Request AJAX and update HTML on complete.
  1045. fetchBlock({
  1046. attributes,
  1047. context,
  1048. clientId,
  1049. query: {
  1050. form: true
  1051. }
  1052. }).done(_ref7 => {
  1053. let {
  1054. data
  1055. } = _ref7;
  1056. this.setHtml(data.form.replaceAll(data.clientId, clientId));
  1057. });
  1058. }
  1059. componentDidRemount() {
  1060. super.componentDidRemount();
  1061. const {
  1062. $el
  1063. } = this.state;
  1064. // Make sure our on append events are registered.
  1065. if ($el.data('acf-events-added') !== true) {
  1066. this.componentDidAppend();
  1067. }
  1068. }
  1069. componentDidAppend() {
  1070. super.componentDidAppend();
  1071. // Extract props.
  1072. const {
  1073. attributes,
  1074. setAttributes,
  1075. clientId
  1076. } = this.props;
  1077. const props = this.props;
  1078. const {
  1079. $el
  1080. } = this.state;
  1081. // Callback for updating block data.
  1082. function serializeData() {
  1083. let silent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1084. const data = acf.serialize($el, `acf-${clientId}`);
  1085. if (silent) {
  1086. attributes.data = data;
  1087. } else {
  1088. setAttributes({
  1089. data
  1090. });
  1091. }
  1092. }
  1093. // Add events.
  1094. let timeout = false;
  1095. $el.on('change keyup', () => {
  1096. clearTimeout(timeout);
  1097. timeout = setTimeout(serializeData, 300);
  1098. });
  1099. // Log initialization for remount check on the persistent element.
  1100. $el.data('acf-events-added', true);
  1101. // Ensure newly added block is saved with data.
  1102. // Do it silently to avoid triggering a preview render.
  1103. if (!attributes.data) {
  1104. serializeData(true);
  1105. }
  1106. }
  1107. }
  1108. /**
  1109. * BlockPreview Class.
  1110. *
  1111. * A react componenet to handle the block preview.
  1112. *
  1113. * @date 19/2/19
  1114. * @since 5.7.12
  1115. *
  1116. * @param string id the block id.
  1117. * @return void
  1118. */
  1119. class BlockPreview extends DynamicHTML {
  1120. setup(_ref8) {
  1121. let {
  1122. clientId,
  1123. name
  1124. } = _ref8;
  1125. const blockType = getBlockType(name);
  1126. const contextPostId = acf.isget(this.props, 'context', 'postId');
  1127. this.id = `BlockPreview-${clientId}`;
  1128. // Apply the contextPostId to the ID if set to stop query loop ID duplication.
  1129. if (contextPostId) {
  1130. this.id = `BlockPreview-${clientId}-${contextPostId}`;
  1131. }
  1132. if (blockType.supports.jsx) {
  1133. this.renderMethod = 'jsx';
  1134. }
  1135. }
  1136. fetch() {
  1137. let args = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
  1138. const {
  1139. attributes = this.props.attributes,
  1140. clientId = this.props.clientId,
  1141. context = this.props.context,
  1142. delay = 0
  1143. } = args;
  1144. const {
  1145. name
  1146. } = this.props;
  1147. // Remember attributes used to fetch HTML.
  1148. this.setState({
  1149. prevAttributes: attributes,
  1150. prevContext: context
  1151. });
  1152. const hash = createBlockAttributesHash(attributes, context);
  1153. // Try preloaded data first.
  1154. let preloaded = this.maybePreload(hash, clientId, false);
  1155. if (preloaded) {
  1156. if (getBlockVersion(name) == 1) {
  1157. preloaded = '<div class="acf-block-preview">' + preloaded + '</div>';
  1158. }
  1159. this.setHtml(preloaded);
  1160. return;
  1161. }
  1162. // Request AJAX and update HTML on complete.
  1163. fetchBlock({
  1164. attributes,
  1165. context,
  1166. clientId,
  1167. query: {
  1168. preview: true
  1169. },
  1170. delay
  1171. }).done(_ref9 => {
  1172. let {
  1173. data
  1174. } = _ref9;
  1175. let replaceHtml = data.preview.replaceAll(data.clientId, clientId);
  1176. if (getBlockVersion(name) == 1) {
  1177. replaceHtml = '<div class="acf-block-preview">' + replaceHtml + '</div>';
  1178. }
  1179. this.setHtml(replaceHtml);
  1180. });
  1181. }
  1182. componentDidAppend() {
  1183. super.componentDidAppend();
  1184. this.renderBlockPreviewEvent();
  1185. }
  1186. shouldComponentUpdate(nextProps, nextState) {
  1187. const nextAttributes = nextProps.attributes;
  1188. const thisAttributes = this.props.attributes;
  1189. // Update preview if block data has changed.
  1190. if (!compareObjects(nextAttributes, thisAttributes) || !compareObjects(nextProps.context, this.props.context)) {
  1191. let delay = 0;
  1192. // Delay fetch when editing className or anchor to simulate consistent logic to custom fields.
  1193. if (nextAttributes.className !== thisAttributes.className) {
  1194. delay = 300;
  1195. }
  1196. if (nextAttributes.anchor !== thisAttributes.anchor) {
  1197. delay = 300;
  1198. }
  1199. this.fetch({
  1200. attributes: nextAttributes,
  1201. context: nextProps.context,
  1202. delay
  1203. });
  1204. }
  1205. return super.shouldComponentUpdate(nextProps, nextState);
  1206. }
  1207. renderBlockPreviewEvent() {
  1208. // Extract props.
  1209. const {
  1210. attributes,
  1211. name
  1212. } = this.props;
  1213. const {
  1214. $el,
  1215. ref
  1216. } = this.state;
  1217. var blockElement;
  1218. // Generate action friendly type.
  1219. const type = attributes.name.replace('acf/', '');
  1220. if (ref && ref.current) {
  1221. // We've got a react ref from a JSX container. Use the parent as the blockElement
  1222. blockElement = $(ref.current).parent();
  1223. } else if (getBlockVersion(name) == 1) {
  1224. blockElement = $el;
  1225. } else {
  1226. blockElement = $el.parents('.acf-block-preview');
  1227. }
  1228. // Do action.
  1229. acf.doAction('render_block_preview', blockElement, attributes);
  1230. acf.doAction(`render_block_preview/type=${type}`, blockElement, attributes);
  1231. }
  1232. componentDidRemount() {
  1233. super.componentDidRemount();
  1234. // Update preview if data has changed since last render (changing from "edit" to "preview").
  1235. if (!compareObjects(this.state.prevAttributes, this.props.attributes) || !compareObjects(this.state.prevContext, this.props.context)) {
  1236. this.fetch();
  1237. }
  1238. // Fire the block preview event so blocks can reinit JS elements.
  1239. // React reusing DOM elements covers any potential race condition from the above fetch.
  1240. this.renderBlockPreviewEvent();
  1241. }
  1242. }
  1243. /**
  1244. * Initializes ACF Blocks logic and registration.
  1245. *
  1246. * @since 5.9.0
  1247. */
  1248. function initialize() {
  1249. // Add support for WordPress versions before 5.2.
  1250. if (!wp.blockEditor) {
  1251. wp.blockEditor = wp.editor;
  1252. }
  1253. // Register block types.
  1254. const blockTypes = acf.get('blockTypes');
  1255. if (blockTypes) {
  1256. blockTypes.map(registerBlockType);
  1257. }
  1258. }
  1259. // Run the initialize callback during the "prepare" action.
  1260. // This ensures that all localized data is available and that blocks are registered before the WP editor has been instantiated.
  1261. acf.addAction('prepare', initialize);
  1262. /**
  1263. * Returns a valid vertical alignment.
  1264. *
  1265. * @date 07/08/2020
  1266. * @since 5.9.0
  1267. *
  1268. * @param string align A vertical alignment.
  1269. * @return string
  1270. */
  1271. function validateVerticalAlignment(align) {
  1272. const ALIGNMENTS = ['top', 'center', 'bottom'];
  1273. const DEFAULT = 'top';
  1274. return ALIGNMENTS.includes(align) ? align : DEFAULT;
  1275. }
  1276. /**
  1277. * Returns a valid horizontal alignment.
  1278. *
  1279. * @date 07/08/2020
  1280. * @since 5.9.0
  1281. *
  1282. * @param string align A horizontal alignment.
  1283. * @return string
  1284. */
  1285. function validateHorizontalAlignment(align) {
  1286. const ALIGNMENTS = ['left', 'center', 'right'];
  1287. const DEFAULT = acf.get('rtl') ? 'right' : 'left';
  1288. return ALIGNMENTS.includes(align) ? align : DEFAULT;
  1289. }
  1290. /**
  1291. * Returns a valid matrix alignment.
  1292. *
  1293. * Written for "upgrade-path" compatibility from vertical alignment to matrix alignment.
  1294. *
  1295. * @date 07/08/2020
  1296. * @since 5.9.0
  1297. *
  1298. * @param string align A matrix alignment.
  1299. * @return string
  1300. */
  1301. function validateMatrixAlignment(align) {
  1302. const DEFAULT = 'center center';
  1303. if (align) {
  1304. const [y, x] = align.split(' ');
  1305. return `${validateVerticalAlignment(y)} ${validateHorizontalAlignment(x)}`;
  1306. }
  1307. return DEFAULT;
  1308. }
  1309. /**
  1310. * A higher order component adding alignContent editing functionality.
  1311. *
  1312. * @date 08/07/2020
  1313. * @since 5.9.0
  1314. *
  1315. * @param component OriginalBlockEdit The original BlockEdit component.
  1316. * @param object blockType The block type settings.
  1317. * @return component
  1318. */
  1319. function withAlignContentComponent(OriginalBlockEdit, blockType) {
  1320. // Determine alignment vars
  1321. let type = blockType.supports.align_content || blockType.supports.alignContent;
  1322. let AlignmentComponent;
  1323. let validateAlignment;
  1324. switch (type) {
  1325. case 'matrix':
  1326. AlignmentComponent = BlockAlignmentMatrixControl || BlockAlignmentMatrixToolbar;
  1327. validateAlignment = validateMatrixAlignment;
  1328. break;
  1329. default:
  1330. AlignmentComponent = BlockVerticalAlignmentToolbar;
  1331. validateAlignment = validateVerticalAlignment;
  1332. break;
  1333. }
  1334. // Ensure alignment component exists.
  1335. if (AlignmentComponent === undefined) {
  1336. console.warn(`The "${type}" alignment component was not found.`);
  1337. return OriginalBlockEdit;
  1338. }
  1339. // Ensure correct block attribute data is sent in intial preview AJAX request.
  1340. blockType.alignContent = validateAlignment(blockType.alignContent);
  1341. // Return wrapped component.
  1342. return class WrappedBlockEdit extends Component {
  1343. render() {
  1344. const {
  1345. attributes,
  1346. setAttributes
  1347. } = this.props;
  1348. const {
  1349. alignContent
  1350. } = attributes;
  1351. function onChangeAlignContent(alignContent) {
  1352. setAttributes({
  1353. alignContent: validateAlignment(alignContent)
  1354. });
  1355. }
  1356. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockControls, {
  1357. group: "block"
  1358. }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(AlignmentComponent, {
  1359. label: acf.__('Change content alignment'),
  1360. value: validateAlignment(alignContent),
  1361. onChange: onChangeAlignContent
  1362. })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(OriginalBlockEdit, this.props));
  1363. }
  1364. };
  1365. }
  1366. /**
  1367. * A higher order component adding alignText editing functionality.
  1368. *
  1369. * @date 08/07/2020
  1370. * @since 5.9.0
  1371. *
  1372. * @param component OriginalBlockEdit The original BlockEdit component.
  1373. * @param object blockType The block type settings.
  1374. * @return component
  1375. */
  1376. function withAlignTextComponent(OriginalBlockEdit, blockType) {
  1377. const validateAlignment = validateHorizontalAlignment;
  1378. // Ensure correct block attribute data is sent in intial preview AJAX request.
  1379. blockType.alignText = validateAlignment(blockType.alignText);
  1380. // Return wrapped component.
  1381. return class WrappedBlockEdit extends Component {
  1382. render() {
  1383. const {
  1384. attributes,
  1385. setAttributes
  1386. } = this.props;
  1387. const {
  1388. alignText
  1389. } = attributes;
  1390. function onChangeAlignText(alignText) {
  1391. setAttributes({
  1392. alignText: validateAlignment(alignText)
  1393. });
  1394. }
  1395. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockControls, {
  1396. group: "block"
  1397. }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(AlignmentToolbar, {
  1398. value: validateAlignment(alignText),
  1399. onChange: onChangeAlignText
  1400. })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(OriginalBlockEdit, this.props));
  1401. }
  1402. };
  1403. }
  1404. /**
  1405. * A higher order component adding full height support.
  1406. *
  1407. * @date 19/07/2021
  1408. * @since 5.10.0
  1409. *
  1410. * @param component OriginalBlockEdit The original BlockEdit component.
  1411. * @param object blockType The block type settings.
  1412. * @return component
  1413. */
  1414. function withFullHeightComponent(OriginalBlockEdit, blockType) {
  1415. if (!BlockFullHeightAlignmentControl) return OriginalBlockEdit;
  1416. // Return wrapped component.
  1417. return class WrappedBlockEdit extends Component {
  1418. render() {
  1419. const {
  1420. attributes,
  1421. setAttributes
  1422. } = this.props;
  1423. const {
  1424. fullHeight
  1425. } = attributes;
  1426. function onToggleFullHeight(fullHeight) {
  1427. setAttributes({
  1428. fullHeight
  1429. });
  1430. }
  1431. return (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(Fragment, null, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockControls, {
  1432. group: "block"
  1433. }, (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(BlockFullHeightAlignmentControl, {
  1434. isActive: fullHeight,
  1435. onToggle: onToggleFullHeight
  1436. })), (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.createElement)(OriginalBlockEdit, this.props));
  1437. }
  1438. };
  1439. }
  1440. /**
  1441. * Appends a backwards compatibility attribute for conversion.
  1442. *
  1443. * @since 6.0
  1444. *
  1445. * @param object attributes The block type attributes.
  1446. * @return object
  1447. */
  1448. function addBackCompatAttribute(attributes, new_attribute, type) {
  1449. attributes[new_attribute] = {
  1450. type: type
  1451. };
  1452. return attributes;
  1453. }
  1454. /**
  1455. * Create a block hash from attributes
  1456. *
  1457. * @since 6.0
  1458. *
  1459. * @param object attributes The block type attributes.
  1460. * @param object context The current block context object.
  1461. * @return string
  1462. */
  1463. function createBlockAttributesHash(attributes, context) {
  1464. attributes['_acf_context'] = context;
  1465. return md5(JSON.stringify(Object.keys(attributes).sort().reduce((acc, currValue) => {
  1466. acc[currValue] = attributes[currValue];
  1467. return acc;
  1468. }, {})));
  1469. }
  1470. })(jQuery);
  1471. /***/ }),
  1472. /***/ "./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-jsx-names.js":
  1473. /*!****************************************************************************!*\
  1474. !*** ./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-jsx-names.js ***!
  1475. \****************************************************************************/
  1476. /***/ (function() {
  1477. (function ($, undefined) {
  1478. acf.jsxNameReplacements = {
  1479. 'accent-height': 'accentHeight',
  1480. accentheight: 'accentHeight',
  1481. 'accept-charset': 'acceptCharset',
  1482. acceptcharset: 'acceptCharset',
  1483. accesskey: 'accessKey',
  1484. 'alignment-baseline': 'alignmentBaseline',
  1485. alignmentbaseline: 'alignmentBaseline',
  1486. allowedblocks: 'allowedBlocks',
  1487. allowfullscreen: 'allowFullScreen',
  1488. allowreorder: 'allowReorder',
  1489. 'arabic-form': 'arabicForm',
  1490. arabicform: 'arabicForm',
  1491. attributename: 'attributeName',
  1492. attributetype: 'attributeType',
  1493. autocapitalize: 'autoCapitalize',
  1494. autocomplete: 'autoComplete',
  1495. autocorrect: 'autoCorrect',
  1496. autofocus: 'autoFocus',
  1497. autoplay: 'autoPlay',
  1498. autoreverse: 'autoReverse',
  1499. autosave: 'autoSave',
  1500. basefrequency: 'baseFrequency',
  1501. 'baseline-shift': 'baselineShift',
  1502. baselineshift: 'baselineShift',
  1503. baseprofile: 'baseProfile',
  1504. calcmode: 'calcMode',
  1505. 'cap-height': 'capHeight',
  1506. capheight: 'capHeight',
  1507. cellpadding: 'cellPadding',
  1508. cellspacing: 'cellSpacing',
  1509. charset: 'charSet',
  1510. class: 'className',
  1511. classid: 'classID',
  1512. classname: 'className',
  1513. 'clip-path': 'clipPath',
  1514. 'clip-rule': 'clipRule',
  1515. clippath: 'clipPath',
  1516. clippathunits: 'clipPathUnits',
  1517. cliprule: 'clipRule',
  1518. 'color-interpolation': 'colorInterpolation',
  1519. 'color-interpolation-filters': 'colorInterpolationFilters',
  1520. 'color-profile': 'colorProfile',
  1521. 'color-rendering': 'colorRendering',
  1522. colorinterpolation: 'colorInterpolation',
  1523. colorinterpolationfilters: 'colorInterpolationFilters',
  1524. colorprofile: 'colorProfile',
  1525. colorrendering: 'colorRendering',
  1526. colspan: 'colSpan',
  1527. contenteditable: 'contentEditable',
  1528. contentscripttype: 'contentScriptType',
  1529. contentstyletype: 'contentStyleType',
  1530. contextmenu: 'contextMenu',
  1531. controlslist: 'controlsList',
  1532. crossorigin: 'crossOrigin',
  1533. dangerouslysetinnerhtml: 'dangerouslySetInnerHTML',
  1534. datetime: 'dateTime',
  1535. defaultchecked: 'defaultChecked',
  1536. defaultvalue: 'defaultValue',
  1537. diffuseconstant: 'diffuseConstant',
  1538. disablepictureinpicture: 'disablePictureInPicture',
  1539. disableremoteplayback: 'disableRemotePlayback',
  1540. 'dominant-baseline': 'dominantBaseline',
  1541. dominantbaseline: 'dominantBaseline',
  1542. edgemode: 'edgeMode',
  1543. 'enable-background': 'enableBackground',
  1544. enablebackground: 'enableBackground',
  1545. enctype: 'encType',
  1546. enterkeyhint: 'enterKeyHint',
  1547. externalresourcesrequired: 'externalResourcesRequired',
  1548. 'fill-opacity': 'fillOpacity',
  1549. 'fill-rule': 'fillRule',
  1550. fillopacity: 'fillOpacity',
  1551. fillrule: 'fillRule',
  1552. filterres: 'filterRes',
  1553. filterunits: 'filterUnits',
  1554. 'flood-color': 'floodColor',
  1555. 'flood-opacity': 'floodOpacity',
  1556. floodcolor: 'floodColor',
  1557. floodopacity: 'floodOpacity',
  1558. 'font-family': 'fontFamily',
  1559. 'font-size': 'fontSize',
  1560. 'font-size-adjust': 'fontSizeAdjust',
  1561. 'font-stretch': 'fontStretch',
  1562. 'font-style': 'fontStyle',
  1563. 'font-variant': 'fontVariant',
  1564. 'font-weight': 'fontWeight',
  1565. fontfamily: 'fontFamily',
  1566. fontsize: 'fontSize',
  1567. fontsizeadjust: 'fontSizeAdjust',
  1568. fontstretch: 'fontStretch',
  1569. fontstyle: 'fontStyle',
  1570. fontvariant: 'fontVariant',
  1571. fontweight: 'fontWeight',
  1572. for: 'htmlFor',
  1573. foreignobject: 'foreignObject',
  1574. formaction: 'formAction',
  1575. formenctype: 'formEncType',
  1576. formmethod: 'formMethod',
  1577. formnovalidate: 'formNoValidate',
  1578. formtarget: 'formTarget',
  1579. frameborder: 'frameBorder',
  1580. 'glyph-name': 'glyphName',
  1581. 'glyph-orientation-horizontal': 'glyphOrientationHorizontal',
  1582. 'glyph-orientation-vertical': 'glyphOrientationVertical',
  1583. glyphname: 'glyphName',
  1584. glyphorientationhorizontal: 'glyphOrientationHorizontal',
  1585. glyphorientationvertical: 'glyphOrientationVertical',
  1586. glyphref: 'glyphRef',
  1587. gradienttransform: 'gradientTransform',
  1588. gradientunits: 'gradientUnits',
  1589. 'horiz-adv-x': 'horizAdvX',
  1590. 'horiz-origin-x': 'horizOriginX',
  1591. horizadvx: 'horizAdvX',
  1592. horizoriginx: 'horizOriginX',
  1593. hreflang: 'hrefLang',
  1594. htmlfor: 'htmlFor',
  1595. 'http-equiv': 'httpEquiv',
  1596. httpequiv: 'httpEquiv',
  1597. 'image-rendering': 'imageRendering',
  1598. imagerendering: 'imageRendering',
  1599. innerhtml: 'innerHTML',
  1600. inputmode: 'inputMode',
  1601. itemid: 'itemID',
  1602. itemprop: 'itemProp',
  1603. itemref: 'itemRef',
  1604. itemscope: 'itemScope',
  1605. itemtype: 'itemType',
  1606. kernelmatrix: 'kernelMatrix',
  1607. kernelunitlength: 'kernelUnitLength',
  1608. keyparams: 'keyParams',
  1609. keypoints: 'keyPoints',
  1610. keysplines: 'keySplines',
  1611. keytimes: 'keyTimes',
  1612. keytype: 'keyType',
  1613. lengthadjust: 'lengthAdjust',
  1614. 'letter-spacing': 'letterSpacing',
  1615. letterspacing: 'letterSpacing',
  1616. 'lighting-color': 'lightingColor',
  1617. lightingcolor: 'lightingColor',
  1618. limitingconeangle: 'limitingConeAngle',
  1619. marginheight: 'marginHeight',
  1620. marginwidth: 'marginWidth',
  1621. 'marker-end': 'markerEnd',
  1622. 'marker-mid': 'markerMid',
  1623. 'marker-start': 'markerStart',
  1624. markerend: 'markerEnd',
  1625. markerheight: 'markerHeight',
  1626. markermid: 'markerMid',
  1627. markerstart: 'markerStart',
  1628. markerunits: 'markerUnits',
  1629. markerwidth: 'markerWidth',
  1630. maskcontentunits: 'maskContentUnits',
  1631. maskunits: 'maskUnits',
  1632. maxlength: 'maxLength',
  1633. mediagroup: 'mediaGroup',
  1634. minlength: 'minLength',
  1635. nomodule: 'noModule',
  1636. novalidate: 'noValidate',
  1637. numoctaves: 'numOctaves',
  1638. 'overline-position': 'overlinePosition',
  1639. 'overline-thickness': 'overlineThickness',
  1640. overlineposition: 'overlinePosition',
  1641. overlinethickness: 'overlineThickness',
  1642. 'paint-order': 'paintOrder',
  1643. paintorder: 'paintOrder',
  1644. 'panose-1': 'panose1',
  1645. pathlength: 'pathLength',
  1646. patterncontentunits: 'patternContentUnits',
  1647. patterntransform: 'patternTransform',
  1648. patternunits: 'patternUnits',
  1649. playsinline: 'playsInline',
  1650. 'pointer-events': 'pointerEvents',
  1651. pointerevents: 'pointerEvents',
  1652. pointsatx: 'pointsAtX',
  1653. pointsaty: 'pointsAtY',
  1654. pointsatz: 'pointsAtZ',
  1655. preservealpha: 'preserveAlpha',
  1656. preserveaspectratio: 'preserveAspectRatio',
  1657. primitiveunits: 'primitiveUnits',
  1658. radiogroup: 'radioGroup',
  1659. readonly: 'readOnly',
  1660. referrerpolicy: 'referrerPolicy',
  1661. refx: 'refX',
  1662. refy: 'refY',
  1663. 'rendering-intent': 'renderingIntent',
  1664. renderingintent: 'renderingIntent',
  1665. repeatcount: 'repeatCount',
  1666. repeatdur: 'repeatDur',
  1667. requiredextensions: 'requiredExtensions',
  1668. requiredfeatures: 'requiredFeatures',
  1669. rowspan: 'rowSpan',
  1670. 'shape-rendering': 'shapeRendering',
  1671. shaperendering: 'shapeRendering',
  1672. specularconstant: 'specularConstant',
  1673. specularexponent: 'specularExponent',
  1674. spellcheck: 'spellCheck',
  1675. spreadmethod: 'spreadMethod',
  1676. srcdoc: 'srcDoc',
  1677. srclang: 'srcLang',
  1678. srcset: 'srcSet',
  1679. startoffset: 'startOffset',
  1680. stddeviation: 'stdDeviation',
  1681. stitchtiles: 'stitchTiles',
  1682. 'stop-color': 'stopColor',
  1683. 'stop-opacity': 'stopOpacity',
  1684. stopcolor: 'stopColor',
  1685. stopopacity: 'stopOpacity',
  1686. 'strikethrough-position': 'strikethroughPosition',
  1687. 'strikethrough-thickness': 'strikethroughThickness',
  1688. strikethroughposition: 'strikethroughPosition',
  1689. strikethroughthickness: 'strikethroughThickness',
  1690. 'stroke-dasharray': 'strokeDasharray',
  1691. 'stroke-dashoffset': 'strokeDashoffset',
  1692. 'stroke-linecap': 'strokeLinecap',
  1693. 'stroke-linejoin': 'strokeLinejoin',
  1694. 'stroke-miterlimit': 'strokeMiterlimit',
  1695. 'stroke-opacity': 'strokeOpacity',
  1696. 'stroke-width': 'strokeWidth',
  1697. strokedasharray: 'strokeDasharray',
  1698. strokedashoffset: 'strokeDashoffset',
  1699. strokelinecap: 'strokeLinecap',
  1700. strokelinejoin: 'strokeLinejoin',
  1701. strokemiterlimit: 'strokeMiterlimit',
  1702. strokeopacity: 'strokeOpacity',
  1703. strokewidth: 'strokeWidth',
  1704. suppresscontenteditablewarning: 'suppressContentEditableWarning',
  1705. suppresshydrationwarning: 'suppressHydrationWarning',
  1706. surfacescale: 'surfaceScale',
  1707. systemlanguage: 'systemLanguage',
  1708. tabindex: 'tabIndex',
  1709. tablevalues: 'tableValues',
  1710. targetx: 'targetX',
  1711. targety: 'targetY',
  1712. templatelock: 'templateLock',
  1713. 'text-anchor': 'textAnchor',
  1714. 'text-decoration': 'textDecoration',
  1715. 'text-rendering': 'textRendering',
  1716. textanchor: 'textAnchor',
  1717. textdecoration: 'textDecoration',
  1718. textlength: 'textLength',
  1719. textrendering: 'textRendering',
  1720. 'underline-position': 'underlinePosition',
  1721. 'underline-thickness': 'underlineThickness',
  1722. underlineposition: 'underlinePosition',
  1723. underlinethickness: 'underlineThickness',
  1724. 'unicode-bidi': 'unicodeBidi',
  1725. 'unicode-range': 'unicodeRange',
  1726. unicodebidi: 'unicodeBidi',
  1727. unicoderange: 'unicodeRange',
  1728. 'units-per-em': 'unitsPerEm',
  1729. unitsperem: 'unitsPerEm',
  1730. usemap: 'useMap',
  1731. 'v-alphabetic': 'vAlphabetic',
  1732. 'v-hanging': 'vHanging',
  1733. 'v-ideographic': 'vIdeographic',
  1734. 'v-mathematical': 'vMathematical',
  1735. valphabetic: 'vAlphabetic',
  1736. 'vector-effect': 'vectorEffect',
  1737. vectoreffect: 'vectorEffect',
  1738. 'vert-adv-y': 'vertAdvY',
  1739. 'vert-origin-x': 'vertOriginX',
  1740. 'vert-origin-y': 'vertOriginY',
  1741. vertadvy: 'vertAdvY',
  1742. vertoriginx: 'vertOriginX',
  1743. vertoriginy: 'vertOriginY',
  1744. vhanging: 'vHanging',
  1745. videographic: 'vIdeographic',
  1746. viewbox: 'viewBox',
  1747. viewtarget: 'viewTarget',
  1748. vmathematical: 'vMathematical',
  1749. 'word-spacing': 'wordSpacing',
  1750. wordspacing: 'wordSpacing',
  1751. 'writing-mode': 'writingMode',
  1752. writingmode: 'writingMode',
  1753. 'x-height': 'xHeight',
  1754. xchannelselector: 'xChannelSelector',
  1755. xheight: 'xHeight',
  1756. 'xlink:actuate': 'xlinkActuate',
  1757. 'xlink:arcrole': 'xlinkArcrole',
  1758. 'xlink:href': 'xlinkHref',
  1759. 'xlink:role': 'xlinkRole',
  1760. 'xlink:show': 'xlinkShow',
  1761. 'xlink:title': 'xlinkTitle',
  1762. 'xlink:type': 'xlinkType',
  1763. xlinkactuate: 'xlinkActuate',
  1764. xlinkarcrole: 'xlinkArcrole',
  1765. xlinkhref: 'xlinkHref',
  1766. xlinkrole: 'xlinkRole',
  1767. xlinkshow: 'xlinkShow',
  1768. xlinktitle: 'xlinkTitle',
  1769. xlinktype: 'xlinkType',
  1770. 'xml:base': 'xmlBase',
  1771. 'xml:lang': 'xmlLang',
  1772. 'xml:space': 'xmlSpace',
  1773. xmlbase: 'xmlBase',
  1774. xmllang: 'xmlLang',
  1775. 'xmlns:xlink': 'xmlnsXlink',
  1776. xmlnsxlink: 'xmlnsXlink',
  1777. xmlspace: 'xmlSpace',
  1778. ychannelselector: 'yChannelSelector',
  1779. zoomandpan: 'zoomAndPan'
  1780. };
  1781. })(jQuery);
  1782. /***/ }),
  1783. /***/ "./node_modules/charenc/charenc.js":
  1784. /*!*****************************************!*\
  1785. !*** ./node_modules/charenc/charenc.js ***!
  1786. \*****************************************/
  1787. /***/ (function(module) {
  1788. var charenc = {
  1789. // UTF-8 encoding
  1790. utf8: {
  1791. // Convert a string to a byte array
  1792. stringToBytes: function(str) {
  1793. return charenc.bin.stringToBytes(unescape(encodeURIComponent(str)));
  1794. },
  1795. // Convert a byte array to a string
  1796. bytesToString: function(bytes) {
  1797. return decodeURIComponent(escape(charenc.bin.bytesToString(bytes)));
  1798. }
  1799. },
  1800. // Binary encoding
  1801. bin: {
  1802. // Convert a string to a byte array
  1803. stringToBytes: function(str) {
  1804. for (var bytes = [], i = 0; i < str.length; i++)
  1805. bytes.push(str.charCodeAt(i) & 0xFF);
  1806. return bytes;
  1807. },
  1808. // Convert a byte array to a string
  1809. bytesToString: function(bytes) {
  1810. for (var str = [], i = 0; i < bytes.length; i++)
  1811. str.push(String.fromCharCode(bytes[i]));
  1812. return str.join('');
  1813. }
  1814. }
  1815. };
  1816. module.exports = charenc;
  1817. /***/ }),
  1818. /***/ "./node_modules/crypt/crypt.js":
  1819. /*!*************************************!*\
  1820. !*** ./node_modules/crypt/crypt.js ***!
  1821. \*************************************/
  1822. /***/ (function(module) {
  1823. (function() {
  1824. var base64map
  1825. = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/',
  1826. crypt = {
  1827. // Bit-wise rotation left
  1828. rotl: function(n, b) {
  1829. return (n << b) | (n >>> (32 - b));
  1830. },
  1831. // Bit-wise rotation right
  1832. rotr: function(n, b) {
  1833. return (n << (32 - b)) | (n >>> b);
  1834. },
  1835. // Swap big-endian to little-endian and vice versa
  1836. endian: function(n) {
  1837. // If number given, swap endian
  1838. if (n.constructor == Number) {
  1839. return crypt.rotl(n, 8) & 0x00FF00FF | crypt.rotl(n, 24) & 0xFF00FF00;
  1840. }
  1841. // Else, assume array and swap all items
  1842. for (var i = 0; i < n.length; i++)
  1843. n[i] = crypt.endian(n[i]);
  1844. return n;
  1845. },
  1846. // Generate an array of any length of random bytes
  1847. randomBytes: function(n) {
  1848. for (var bytes = []; n > 0; n--)
  1849. bytes.push(Math.floor(Math.random() * 256));
  1850. return bytes;
  1851. },
  1852. // Convert a byte array to big-endian 32-bit words
  1853. bytesToWords: function(bytes) {
  1854. for (var words = [], i = 0, b = 0; i < bytes.length; i++, b += 8)
  1855. words[b >>> 5] |= bytes[i] << (24 - b % 32);
  1856. return words;
  1857. },
  1858. // Convert big-endian 32-bit words to a byte array
  1859. wordsToBytes: function(words) {
  1860. for (var bytes = [], b = 0; b < words.length * 32; b += 8)
  1861. bytes.push((words[b >>> 5] >>> (24 - b % 32)) & 0xFF);
  1862. return bytes;
  1863. },
  1864. // Convert a byte array to a hex string
  1865. bytesToHex: function(bytes) {
  1866. for (var hex = [], i = 0; i < bytes.length; i++) {
  1867. hex.push((bytes[i] >>> 4).toString(16));
  1868. hex.push((bytes[i] & 0xF).toString(16));
  1869. }
  1870. return hex.join('');
  1871. },
  1872. // Convert a hex string to a byte array
  1873. hexToBytes: function(hex) {
  1874. for (var bytes = [], c = 0; c < hex.length; c += 2)
  1875. bytes.push(parseInt(hex.substr(c, 2), 16));
  1876. return bytes;
  1877. },
  1878. // Convert a byte array to a base-64 string
  1879. bytesToBase64: function(bytes) {
  1880. for (var base64 = [], i = 0; i < bytes.length; i += 3) {
  1881. var triplet = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
  1882. for (var j = 0; j < 4; j++)
  1883. if (i * 8 + j * 6 <= bytes.length * 8)
  1884. base64.push(base64map.charAt((triplet >>> 6 * (3 - j)) & 0x3F));
  1885. else
  1886. base64.push('=');
  1887. }
  1888. return base64.join('');
  1889. },
  1890. // Convert a base-64 string to a byte array
  1891. base64ToBytes: function(base64) {
  1892. // Remove non-base-64 characters
  1893. base64 = base64.replace(/[^A-Z0-9+\/]/ig, '');
  1894. for (var bytes = [], i = 0, imod4 = 0; i < base64.length;
  1895. imod4 = ++i % 4) {
  1896. if (imod4 == 0) continue;
  1897. bytes.push(((base64map.indexOf(base64.charAt(i - 1))
  1898. & (Math.pow(2, -2 * imod4 + 8) - 1)) << (imod4 * 2))
  1899. | (base64map.indexOf(base64.charAt(i)) >>> (6 - imod4 * 2)));
  1900. }
  1901. return bytes;
  1902. }
  1903. };
  1904. module.exports = crypt;
  1905. })();
  1906. /***/ }),
  1907. /***/ "./node_modules/is-buffer/index.js":
  1908. /*!*****************************************!*\
  1909. !*** ./node_modules/is-buffer/index.js ***!
  1910. \*****************************************/
  1911. /***/ (function(module) {
  1912. /*!
  1913. * Determine if an object is a Buffer
  1914. *
  1915. * @author Feross Aboukhadijeh <https://feross.org>
  1916. * @license MIT
  1917. */
  1918. // The _isBuffer check is for Safari 5-7 support, because it's missing
  1919. // Object.prototype.constructor. Remove this eventually
  1920. module.exports = function (obj) {
  1921. return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
  1922. }
  1923. function isBuffer (obj) {
  1924. return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
  1925. }
  1926. // For Node v0.10 support. Remove this eventually.
  1927. function isSlowBuffer (obj) {
  1928. return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
  1929. }
  1930. /***/ }),
  1931. /***/ "./node_modules/md5/md5.js":
  1932. /*!*********************************!*\
  1933. !*** ./node_modules/md5/md5.js ***!
  1934. \*********************************/
  1935. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  1936. (function(){
  1937. var crypt = __webpack_require__(/*! crypt */ "./node_modules/crypt/crypt.js"),
  1938. utf8 = (__webpack_require__(/*! charenc */ "./node_modules/charenc/charenc.js").utf8),
  1939. isBuffer = __webpack_require__(/*! is-buffer */ "./node_modules/is-buffer/index.js"),
  1940. bin = (__webpack_require__(/*! charenc */ "./node_modules/charenc/charenc.js").bin),
  1941. // The core
  1942. md5 = function (message, options) {
  1943. // Convert to byte array
  1944. if (message.constructor == String)
  1945. if (options && options.encoding === 'binary')
  1946. message = bin.stringToBytes(message);
  1947. else
  1948. message = utf8.stringToBytes(message);
  1949. else if (isBuffer(message))
  1950. message = Array.prototype.slice.call(message, 0);
  1951. else if (!Array.isArray(message) && message.constructor !== Uint8Array)
  1952. message = message.toString();
  1953. // else, assume byte array already
  1954. var m = crypt.bytesToWords(message),
  1955. l = message.length * 8,
  1956. a = 1732584193,
  1957. b = -271733879,
  1958. c = -1732584194,
  1959. d = 271733878;
  1960. // Swap endian
  1961. for (var i = 0; i < m.length; i++) {
  1962. m[i] = ((m[i] << 8) | (m[i] >>> 24)) & 0x00FF00FF |
  1963. ((m[i] << 24) | (m[i] >>> 8)) & 0xFF00FF00;
  1964. }
  1965. // Padding
  1966. m[l >>> 5] |= 0x80 << (l % 32);
  1967. m[(((l + 64) >>> 9) << 4) + 14] = l;
  1968. // Method shortcuts
  1969. var FF = md5._ff,
  1970. GG = md5._gg,
  1971. HH = md5._hh,
  1972. II = md5._ii;
  1973. for (var i = 0; i < m.length; i += 16) {
  1974. var aa = a,
  1975. bb = b,
  1976. cc = c,
  1977. dd = d;
  1978. a = FF(a, b, c, d, m[i+ 0], 7, -680876936);
  1979. d = FF(d, a, b, c, m[i+ 1], 12, -389564586);
  1980. c = FF(c, d, a, b, m[i+ 2], 17, 606105819);
  1981. b = FF(b, c, d, a, m[i+ 3], 22, -1044525330);
  1982. a = FF(a, b, c, d, m[i+ 4], 7, -176418897);
  1983. d = FF(d, a, b, c, m[i+ 5], 12, 1200080426);
  1984. c = FF(c, d, a, b, m[i+ 6], 17, -1473231341);
  1985. b = FF(b, c, d, a, m[i+ 7], 22, -45705983);
  1986. a = FF(a, b, c, d, m[i+ 8], 7, 1770035416);
  1987. d = FF(d, a, b, c, m[i+ 9], 12, -1958414417);
  1988. c = FF(c, d, a, b, m[i+10], 17, -42063);
  1989. b = FF(b, c, d, a, m[i+11], 22, -1990404162);
  1990. a = FF(a, b, c, d, m[i+12], 7, 1804603682);
  1991. d = FF(d, a, b, c, m[i+13], 12, -40341101);
  1992. c = FF(c, d, a, b, m[i+14], 17, -1502002290);
  1993. b = FF(b, c, d, a, m[i+15], 22, 1236535329);
  1994. a = GG(a, b, c, d, m[i+ 1], 5, -165796510);
  1995. d = GG(d, a, b, c, m[i+ 6], 9, -1069501632);
  1996. c = GG(c, d, a, b, m[i+11], 14, 643717713);
  1997. b = GG(b, c, d, a, m[i+ 0], 20, -373897302);
  1998. a = GG(a, b, c, d, m[i+ 5], 5, -701558691);
  1999. d = GG(d, a, b, c, m[i+10], 9, 38016083);
  2000. c = GG(c, d, a, b, m[i+15], 14, -660478335);
  2001. b = GG(b, c, d, a, m[i+ 4], 20, -405537848);
  2002. a = GG(a, b, c, d, m[i+ 9], 5, 568446438);
  2003. d = GG(d, a, b, c, m[i+14], 9, -1019803690);
  2004. c = GG(c, d, a, b, m[i+ 3], 14, -187363961);
  2005. b = GG(b, c, d, a, m[i+ 8], 20, 1163531501);
  2006. a = GG(a, b, c, d, m[i+13], 5, -1444681467);
  2007. d = GG(d, a, b, c, m[i+ 2], 9, -51403784);
  2008. c = GG(c, d, a, b, m[i+ 7], 14, 1735328473);
  2009. b = GG(b, c, d, a, m[i+12], 20, -1926607734);
  2010. a = HH(a, b, c, d, m[i+ 5], 4, -378558);
  2011. d = HH(d, a, b, c, m[i+ 8], 11, -2022574463);
  2012. c = HH(c, d, a, b, m[i+11], 16, 1839030562);
  2013. b = HH(b, c, d, a, m[i+14], 23, -35309556);
  2014. a = HH(a, b, c, d, m[i+ 1], 4, -1530992060);
  2015. d = HH(d, a, b, c, m[i+ 4], 11, 1272893353);
  2016. c = HH(c, d, a, b, m[i+ 7], 16, -155497632);
  2017. b = HH(b, c, d, a, m[i+10], 23, -1094730640);
  2018. a = HH(a, b, c, d, m[i+13], 4, 681279174);
  2019. d = HH(d, a, b, c, m[i+ 0], 11, -358537222);
  2020. c = HH(c, d, a, b, m[i+ 3], 16, -722521979);
  2021. b = HH(b, c, d, a, m[i+ 6], 23, 76029189);
  2022. a = HH(a, b, c, d, m[i+ 9], 4, -640364487);
  2023. d = HH(d, a, b, c, m[i+12], 11, -421815835);
  2024. c = HH(c, d, a, b, m[i+15], 16, 530742520);
  2025. b = HH(b, c, d, a, m[i+ 2], 23, -995338651);
  2026. a = II(a, b, c, d, m[i+ 0], 6, -198630844);
  2027. d = II(d, a, b, c, m[i+ 7], 10, 1126891415);
  2028. c = II(c, d, a, b, m[i+14], 15, -1416354905);
  2029. b = II(b, c, d, a, m[i+ 5], 21, -57434055);
  2030. a = II(a, b, c, d, m[i+12], 6, 1700485571);
  2031. d = II(d, a, b, c, m[i+ 3], 10, -1894986606);
  2032. c = II(c, d, a, b, m[i+10], 15, -1051523);
  2033. b = II(b, c, d, a, m[i+ 1], 21, -2054922799);
  2034. a = II(a, b, c, d, m[i+ 8], 6, 1873313359);
  2035. d = II(d, a, b, c, m[i+15], 10, -30611744);
  2036. c = II(c, d, a, b, m[i+ 6], 15, -1560198380);
  2037. b = II(b, c, d, a, m[i+13], 21, 1309151649);
  2038. a = II(a, b, c, d, m[i+ 4], 6, -145523070);
  2039. d = II(d, a, b, c, m[i+11], 10, -1120210379);
  2040. c = II(c, d, a, b, m[i+ 2], 15, 718787259);
  2041. b = II(b, c, d, a, m[i+ 9], 21, -343485551);
  2042. a = (a + aa) >>> 0;
  2043. b = (b + bb) >>> 0;
  2044. c = (c + cc) >>> 0;
  2045. d = (d + dd) >>> 0;
  2046. }
  2047. return crypt.endian([a, b, c, d]);
  2048. };
  2049. // Auxiliary functions
  2050. md5._ff = function (a, b, c, d, x, s, t) {
  2051. var n = a + (b & c | ~b & d) + (x >>> 0) + t;
  2052. return ((n << s) | (n >>> (32 - s))) + b;
  2053. };
  2054. md5._gg = function (a, b, c, d, x, s, t) {
  2055. var n = a + (b & d | c & ~d) + (x >>> 0) + t;
  2056. return ((n << s) | (n >>> (32 - s))) + b;
  2057. };
  2058. md5._hh = function (a, b, c, d, x, s, t) {
  2059. var n = a + (b ^ c ^ d) + (x >>> 0) + t;
  2060. return ((n << s) | (n >>> (32 - s))) + b;
  2061. };
  2062. md5._ii = function (a, b, c, d, x, s, t) {
  2063. var n = a + (c ^ (b | ~d)) + (x >>> 0) + t;
  2064. return ((n << s) | (n >>> (32 - s))) + b;
  2065. };
  2066. // Package private blocksize
  2067. md5._blocksize = 16;
  2068. md5._digestsize = 16;
  2069. module.exports = function (message, options) {
  2070. if (message === undefined || message === null)
  2071. throw new Error('Illegal argument ' + message);
  2072. var digestbytes = crypt.wordsToBytes(md5(message, options));
  2073. return options && options.asBytes ? digestbytes :
  2074. options && options.asString ? bin.bytesToString(digestbytes) :
  2075. crypt.bytesToHex(digestbytes);
  2076. };
  2077. })();
  2078. /***/ }),
  2079. /***/ "./node_modules/object-assign/index.js":
  2080. /*!*********************************************!*\
  2081. !*** ./node_modules/object-assign/index.js ***!
  2082. \*********************************************/
  2083. /***/ (function(module) {
  2084. "use strict";
  2085. /*
  2086. object-assign
  2087. (c) Sindre Sorhus
  2088. @license MIT
  2089. */
  2090. /* eslint-disable no-unused-vars */
  2091. var getOwnPropertySymbols = Object.getOwnPropertySymbols;
  2092. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2093. var propIsEnumerable = Object.prototype.propertyIsEnumerable;
  2094. function toObject(val) {
  2095. if (val === null || val === undefined) {
  2096. throw new TypeError('Object.assign cannot be called with null or undefined');
  2097. }
  2098. return Object(val);
  2099. }
  2100. function shouldUseNative() {
  2101. try {
  2102. if (!Object.assign) {
  2103. return false;
  2104. }
  2105. // Detect buggy property enumeration order in older V8 versions.
  2106. // https://bugs.chromium.org/p/v8/issues/detail?id=4118
  2107. var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
  2108. test1[5] = 'de';
  2109. if (Object.getOwnPropertyNames(test1)[0] === '5') {
  2110. return false;
  2111. }
  2112. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  2113. var test2 = {};
  2114. for (var i = 0; i < 10; i++) {
  2115. test2['_' + String.fromCharCode(i)] = i;
  2116. }
  2117. var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
  2118. return test2[n];
  2119. });
  2120. if (order2.join('') !== '0123456789') {
  2121. return false;
  2122. }
  2123. // https://bugs.chromium.org/p/v8/issues/detail?id=3056
  2124. var test3 = {};
  2125. 'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
  2126. test3[letter] = letter;
  2127. });
  2128. if (Object.keys(Object.assign({}, test3)).join('') !==
  2129. 'abcdefghijklmnopqrst') {
  2130. return false;
  2131. }
  2132. return true;
  2133. } catch (err) {
  2134. // We don't expect any of the above to throw, but better to be safe.
  2135. return false;
  2136. }
  2137. }
  2138. module.exports = shouldUseNative() ? Object.assign : function (target, source) {
  2139. var from;
  2140. var to = toObject(target);
  2141. var symbols;
  2142. for (var s = 1; s < arguments.length; s++) {
  2143. from = Object(arguments[s]);
  2144. for (var key in from) {
  2145. if (hasOwnProperty.call(from, key)) {
  2146. to[key] = from[key];
  2147. }
  2148. }
  2149. if (getOwnPropertySymbols) {
  2150. symbols = getOwnPropertySymbols(from);
  2151. for (var i = 0; i < symbols.length; i++) {
  2152. if (propIsEnumerable.call(from, symbols[i])) {
  2153. to[symbols[i]] = from[symbols[i]];
  2154. }
  2155. }
  2156. }
  2157. }
  2158. return to;
  2159. };
  2160. /***/ }),
  2161. /***/ "./node_modules/react/cjs/react.development.js":
  2162. /*!*****************************************************!*\
  2163. !*** ./node_modules/react/cjs/react.development.js ***!
  2164. \*****************************************************/
  2165. /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
  2166. "use strict";
  2167. /** @license React v17.0.2
  2168. * react.development.js
  2169. *
  2170. * Copyright (c) Facebook, Inc. and its affiliates.
  2171. *
  2172. * This source code is licensed under the MIT license found in the
  2173. * LICENSE file in the root directory of this source tree.
  2174. */
  2175. if (true) {
  2176. (function() {
  2177. 'use strict';
  2178. var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
  2179. // TODO: this is special because it gets imported during build.
  2180. var ReactVersion = '17.0.2';
  2181. // ATTENTION
  2182. // When adding new symbols to this file,
  2183. // Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'
  2184. // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
  2185. // nor polyfill, then a plain number is used for performance.
  2186. var REACT_ELEMENT_TYPE = 0xeac7;
  2187. var REACT_PORTAL_TYPE = 0xeaca;
  2188. exports.Fragment = 0xeacb;
  2189. exports.StrictMode = 0xeacc;
  2190. exports.Profiler = 0xead2;
  2191. var REACT_PROVIDER_TYPE = 0xeacd;
  2192. var REACT_CONTEXT_TYPE = 0xeace;
  2193. var REACT_FORWARD_REF_TYPE = 0xead0;
  2194. exports.Suspense = 0xead1;
  2195. var REACT_SUSPENSE_LIST_TYPE = 0xead8;
  2196. var REACT_MEMO_TYPE = 0xead3;
  2197. var REACT_LAZY_TYPE = 0xead4;
  2198. var REACT_BLOCK_TYPE = 0xead9;
  2199. var REACT_SERVER_BLOCK_TYPE = 0xeada;
  2200. var REACT_FUNDAMENTAL_TYPE = 0xead5;
  2201. var REACT_SCOPE_TYPE = 0xead7;
  2202. var REACT_OPAQUE_ID_TYPE = 0xeae0;
  2203. var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
  2204. var REACT_OFFSCREEN_TYPE = 0xeae2;
  2205. var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
  2206. if (typeof Symbol === 'function' && Symbol.for) {
  2207. var symbolFor = Symbol.for;
  2208. REACT_ELEMENT_TYPE = symbolFor('react.element');
  2209. REACT_PORTAL_TYPE = symbolFor('react.portal');
  2210. exports.Fragment = symbolFor('react.fragment');
  2211. exports.StrictMode = symbolFor('react.strict_mode');
  2212. exports.Profiler = symbolFor('react.profiler');
  2213. REACT_PROVIDER_TYPE = symbolFor('react.provider');
  2214. REACT_CONTEXT_TYPE = symbolFor('react.context');
  2215. REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');
  2216. exports.Suspense = symbolFor('react.suspense');
  2217. REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');
  2218. REACT_MEMO_TYPE = symbolFor('react.memo');
  2219. REACT_LAZY_TYPE = symbolFor('react.lazy');
  2220. REACT_BLOCK_TYPE = symbolFor('react.block');
  2221. REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');
  2222. REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');
  2223. REACT_SCOPE_TYPE = symbolFor('react.scope');
  2224. REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');
  2225. REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');
  2226. REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');
  2227. REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');
  2228. }
  2229. var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
  2230. var FAUX_ITERATOR_SYMBOL = '@@iterator';
  2231. function getIteratorFn(maybeIterable) {
  2232. if (maybeIterable === null || typeof maybeIterable !== 'object') {
  2233. return null;
  2234. }
  2235. var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
  2236. if (typeof maybeIterator === 'function') {
  2237. return maybeIterator;
  2238. }
  2239. return null;
  2240. }
  2241. /**
  2242. * Keeps track of the current dispatcher.
  2243. */
  2244. var ReactCurrentDispatcher = {
  2245. /**
  2246. * @internal
  2247. * @type {ReactComponent}
  2248. */
  2249. current: null
  2250. };
  2251. /**
  2252. * Keeps track of the current batch's configuration such as how long an update
  2253. * should suspend for if it needs to.
  2254. */
  2255. var ReactCurrentBatchConfig = {
  2256. transition: 0
  2257. };
  2258. /**
  2259. * Keeps track of the current owner.
  2260. *
  2261. * The current owner is the component who should own any components that are
  2262. * currently being constructed.
  2263. */
  2264. var ReactCurrentOwner = {
  2265. /**
  2266. * @internal
  2267. * @type {ReactComponent}
  2268. */
  2269. current: null
  2270. };
  2271. var ReactDebugCurrentFrame = {};
  2272. var currentExtraStackFrame = null;
  2273. function setExtraStackFrame(stack) {
  2274. {
  2275. currentExtraStackFrame = stack;
  2276. }
  2277. }
  2278. {
  2279. ReactDebugCurrentFrame.setExtraStackFrame = function (stack) {
  2280. {
  2281. currentExtraStackFrame = stack;
  2282. }
  2283. }; // Stack implementation injected by the current renderer.
  2284. ReactDebugCurrentFrame.getCurrentStack = null;
  2285. ReactDebugCurrentFrame.getStackAddendum = function () {
  2286. var stack = ''; // Add an extra top frame while an element is being validated
  2287. if (currentExtraStackFrame) {
  2288. stack += currentExtraStackFrame;
  2289. } // Delegate to the injected renderer-specific implementation
  2290. var impl = ReactDebugCurrentFrame.getCurrentStack;
  2291. if (impl) {
  2292. stack += impl() || '';
  2293. }
  2294. return stack;
  2295. };
  2296. }
  2297. /**
  2298. * Used by act() to track whether you're inside an act() scope.
  2299. */
  2300. var IsSomeRendererActing = {
  2301. current: false
  2302. };
  2303. var ReactSharedInternals = {
  2304. ReactCurrentDispatcher: ReactCurrentDispatcher,
  2305. ReactCurrentBatchConfig: ReactCurrentBatchConfig,
  2306. ReactCurrentOwner: ReactCurrentOwner,
  2307. IsSomeRendererActing: IsSomeRendererActing,
  2308. // Used by renderers to avoid bundling object-assign twice in UMD bundles:
  2309. assign: _assign
  2310. };
  2311. {
  2312. ReactSharedInternals.ReactDebugCurrentFrame = ReactDebugCurrentFrame;
  2313. }
  2314. // by calls to these methods by a Babel plugin.
  2315. //
  2316. // In PROD (or in packages without access to React internals),
  2317. // they are left as they are instead.
  2318. function warn(format) {
  2319. {
  2320. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  2321. args[_key - 1] = arguments[_key];
  2322. }
  2323. printWarning('warn', format, args);
  2324. }
  2325. }
  2326. function error(format) {
  2327. {
  2328. for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  2329. args[_key2 - 1] = arguments[_key2];
  2330. }
  2331. printWarning('error', format, args);
  2332. }
  2333. }
  2334. function printWarning(level, format, args) {
  2335. // When changing this logic, you might want to also
  2336. // update consoleWithStackDev.www.js as well.
  2337. {
  2338. var ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
  2339. var stack = ReactDebugCurrentFrame.getStackAddendum();
  2340. if (stack !== '') {
  2341. format += '%s';
  2342. args = args.concat([stack]);
  2343. }
  2344. var argsWithFormat = args.map(function (item) {
  2345. return '' + item;
  2346. }); // Careful: RN currently depends on this prefix
  2347. argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it
  2348. // breaks IE9: https://github.com/facebook/react/issues/13610
  2349. // eslint-disable-next-line react-internal/no-production-logging
  2350. Function.prototype.apply.call(console[level], console, argsWithFormat);
  2351. }
  2352. }
  2353. var didWarnStateUpdateForUnmountedComponent = {};
  2354. function warnNoop(publicInstance, callerName) {
  2355. {
  2356. var _constructor = publicInstance.constructor;
  2357. var componentName = _constructor && (_constructor.displayName || _constructor.name) || 'ReactClass';
  2358. var warningKey = componentName + "." + callerName;
  2359. if (didWarnStateUpdateForUnmountedComponent[warningKey]) {
  2360. return;
  2361. }
  2362. error("Can't call %s on a component that is not yet mounted. " + 'This is a no-op, but it might indicate a bug in your application. ' + 'Instead, assign to `this.state` directly or define a `state = {};` ' + 'class property with the desired state in the %s component.', callerName, componentName);
  2363. didWarnStateUpdateForUnmountedComponent[warningKey] = true;
  2364. }
  2365. }
  2366. /**
  2367. * This is the abstract API for an update queue.
  2368. */
  2369. var ReactNoopUpdateQueue = {
  2370. /**
  2371. * Checks whether or not this composite component is mounted.
  2372. * @param {ReactClass} publicInstance The instance we want to test.
  2373. * @return {boolean} True if mounted, false otherwise.
  2374. * @protected
  2375. * @final
  2376. */
  2377. isMounted: function (publicInstance) {
  2378. return false;
  2379. },
  2380. /**
  2381. * Forces an update. This should only be invoked when it is known with
  2382. * certainty that we are **not** in a DOM transaction.
  2383. *
  2384. * You may want to call this when you know that some deeper aspect of the
  2385. * component's state has changed but `setState` was not called.
  2386. *
  2387. * This will not invoke `shouldComponentUpdate`, but it will invoke
  2388. * `componentWillUpdate` and `componentDidUpdate`.
  2389. *
  2390. * @param {ReactClass} publicInstance The instance that should rerender.
  2391. * @param {?function} callback Called after component is updated.
  2392. * @param {?string} callerName name of the calling function in the public API.
  2393. * @internal
  2394. */
  2395. enqueueForceUpdate: function (publicInstance, callback, callerName) {
  2396. warnNoop(publicInstance, 'forceUpdate');
  2397. },
  2398. /**
  2399. * Replaces all of the state. Always use this or `setState` to mutate state.
  2400. * You should treat `this.state` as immutable.
  2401. *
  2402. * There is no guarantee that `this.state` will be immediately updated, so
  2403. * accessing `this.state` after calling this method may return the old value.
  2404. *
  2405. * @param {ReactClass} publicInstance The instance that should rerender.
  2406. * @param {object} completeState Next state.
  2407. * @param {?function} callback Called after component is updated.
  2408. * @param {?string} callerName name of the calling function in the public API.
  2409. * @internal
  2410. */
  2411. enqueueReplaceState: function (publicInstance, completeState, callback, callerName) {
  2412. warnNoop(publicInstance, 'replaceState');
  2413. },
  2414. /**
  2415. * Sets a subset of the state. This only exists because _pendingState is
  2416. * internal. This provides a merging strategy that is not available to deep
  2417. * properties which is confusing. TODO: Expose pendingState or don't use it
  2418. * during the merge.
  2419. *
  2420. * @param {ReactClass} publicInstance The instance that should rerender.
  2421. * @param {object} partialState Next partial state to be merged with state.
  2422. * @param {?function} callback Called after component is updated.
  2423. * @param {?string} Name of the calling function in the public API.
  2424. * @internal
  2425. */
  2426. enqueueSetState: function (publicInstance, partialState, callback, callerName) {
  2427. warnNoop(publicInstance, 'setState');
  2428. }
  2429. };
  2430. var emptyObject = {};
  2431. {
  2432. Object.freeze(emptyObject);
  2433. }
  2434. /**
  2435. * Base class helpers for the updating state of a component.
  2436. */
  2437. function Component(props, context, updater) {
  2438. this.props = props;
  2439. this.context = context; // If a component has string refs, we will assign a different object later.
  2440. this.refs = emptyObject; // We initialize the default updater but the real one gets injected by the
  2441. // renderer.
  2442. this.updater = updater || ReactNoopUpdateQueue;
  2443. }
  2444. Component.prototype.isReactComponent = {};
  2445. /**
  2446. * Sets a subset of the state. Always use this to mutate
  2447. * state. You should treat `this.state` as immutable.
  2448. *
  2449. * There is no guarantee that `this.state` will be immediately updated, so
  2450. * accessing `this.state` after calling this method may return the old value.
  2451. *
  2452. * There is no guarantee that calls to `setState` will run synchronously,
  2453. * as they may eventually be batched together. You can provide an optional
  2454. * callback that will be executed when the call to setState is actually
  2455. * completed.
  2456. *
  2457. * When a function is provided to setState, it will be called at some point in
  2458. * the future (not synchronously). It will be called with the up to date
  2459. * component arguments (state, props, context). These values can be different
  2460. * from this.* because your function may be called after receiveProps but before
  2461. * shouldComponentUpdate, and this new state, props, and context will not yet be
  2462. * assigned to this.
  2463. *
  2464. * @param {object|function} partialState Next partial state or function to
  2465. * produce next partial state to be merged with current state.
  2466. * @param {?function} callback Called after state is updated.
  2467. * @final
  2468. * @protected
  2469. */
  2470. Component.prototype.setState = function (partialState, callback) {
  2471. if (!(typeof partialState === 'object' || typeof partialState === 'function' || partialState == null)) {
  2472. {
  2473. throw Error( "setState(...): takes an object of state variables to update or a function which returns an object of state variables." );
  2474. }
  2475. }
  2476. this.updater.enqueueSetState(this, partialState, callback, 'setState');
  2477. };
  2478. /**
  2479. * Forces an update. This should only be invoked when it is known with
  2480. * certainty that we are **not** in a DOM transaction.
  2481. *
  2482. * You may want to call this when you know that some deeper aspect of the
  2483. * component's state has changed but `setState` was not called.
  2484. *
  2485. * This will not invoke `shouldComponentUpdate`, but it will invoke
  2486. * `componentWillUpdate` and `componentDidUpdate`.
  2487. *
  2488. * @param {?function} callback Called after update is complete.
  2489. * @final
  2490. * @protected
  2491. */
  2492. Component.prototype.forceUpdate = function (callback) {
  2493. this.updater.enqueueForceUpdate(this, callback, 'forceUpdate');
  2494. };
  2495. /**
  2496. * Deprecated APIs. These APIs used to exist on classic React classes but since
  2497. * we would like to deprecate them, we're not going to move them over to this
  2498. * modern base class. Instead, we define a getter that warns if it's accessed.
  2499. */
  2500. {
  2501. var deprecatedAPIs = {
  2502. isMounted: ['isMounted', 'Instead, make sure to clean up subscriptions and pending requests in ' + 'componentWillUnmount to prevent memory leaks.'],
  2503. replaceState: ['replaceState', 'Refactor your code to use setState instead (see ' + 'https://github.com/facebook/react/issues/3236).']
  2504. };
  2505. var defineDeprecationWarning = function (methodName, info) {
  2506. Object.defineProperty(Component.prototype, methodName, {
  2507. get: function () {
  2508. warn('%s(...) is deprecated in plain JavaScript React classes. %s', info[0], info[1]);
  2509. return undefined;
  2510. }
  2511. });
  2512. };
  2513. for (var fnName in deprecatedAPIs) {
  2514. if (deprecatedAPIs.hasOwnProperty(fnName)) {
  2515. defineDeprecationWarning(fnName, deprecatedAPIs[fnName]);
  2516. }
  2517. }
  2518. }
  2519. function ComponentDummy() {}
  2520. ComponentDummy.prototype = Component.prototype;
  2521. /**
  2522. * Convenience component with default shallow equality check for sCU.
  2523. */
  2524. function PureComponent(props, context, updater) {
  2525. this.props = props;
  2526. this.context = context; // If a component has string refs, we will assign a different object later.
  2527. this.refs = emptyObject;
  2528. this.updater = updater || ReactNoopUpdateQueue;
  2529. }
  2530. var pureComponentPrototype = PureComponent.prototype = new ComponentDummy();
  2531. pureComponentPrototype.constructor = PureComponent; // Avoid an extra prototype jump for these methods.
  2532. _assign(pureComponentPrototype, Component.prototype);
  2533. pureComponentPrototype.isPureReactComponent = true;
  2534. // an immutable object with a single mutable value
  2535. function createRef() {
  2536. var refObject = {
  2537. current: null
  2538. };
  2539. {
  2540. Object.seal(refObject);
  2541. }
  2542. return refObject;
  2543. }
  2544. function getWrappedName(outerType, innerType, wrapperName) {
  2545. var functionName = innerType.displayName || innerType.name || '';
  2546. return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
  2547. }
  2548. function getContextName(type) {
  2549. return type.displayName || 'Context';
  2550. }
  2551. function getComponentName(type) {
  2552. if (type == null) {
  2553. // Host root, text node or just invalid type.
  2554. return null;
  2555. }
  2556. {
  2557. if (typeof type.tag === 'number') {
  2558. error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');
  2559. }
  2560. }
  2561. if (typeof type === 'function') {
  2562. return type.displayName || type.name || null;
  2563. }
  2564. if (typeof type === 'string') {
  2565. return type;
  2566. }
  2567. switch (type) {
  2568. case exports.Fragment:
  2569. return 'Fragment';
  2570. case REACT_PORTAL_TYPE:
  2571. return 'Portal';
  2572. case exports.Profiler:
  2573. return 'Profiler';
  2574. case exports.StrictMode:
  2575. return 'StrictMode';
  2576. case exports.Suspense:
  2577. return 'Suspense';
  2578. case REACT_SUSPENSE_LIST_TYPE:
  2579. return 'SuspenseList';
  2580. }
  2581. if (typeof type === 'object') {
  2582. switch (type.$$typeof) {
  2583. case REACT_CONTEXT_TYPE:
  2584. var context = type;
  2585. return getContextName(context) + '.Consumer';
  2586. case REACT_PROVIDER_TYPE:
  2587. var provider = type;
  2588. return getContextName(provider._context) + '.Provider';
  2589. case REACT_FORWARD_REF_TYPE:
  2590. return getWrappedName(type, type.render, 'ForwardRef');
  2591. case REACT_MEMO_TYPE:
  2592. return getComponentName(type.type);
  2593. case REACT_BLOCK_TYPE:
  2594. return getComponentName(type._render);
  2595. case REACT_LAZY_TYPE:
  2596. {
  2597. var lazyComponent = type;
  2598. var payload = lazyComponent._payload;
  2599. var init = lazyComponent._init;
  2600. try {
  2601. return getComponentName(init(payload));
  2602. } catch (x) {
  2603. return null;
  2604. }
  2605. }
  2606. }
  2607. }
  2608. return null;
  2609. }
  2610. var hasOwnProperty = Object.prototype.hasOwnProperty;
  2611. var RESERVED_PROPS = {
  2612. key: true,
  2613. ref: true,
  2614. __self: true,
  2615. __source: true
  2616. };
  2617. var specialPropKeyWarningShown, specialPropRefWarningShown, didWarnAboutStringRefs;
  2618. {
  2619. didWarnAboutStringRefs = {};
  2620. }
  2621. function hasValidRef(config) {
  2622. {
  2623. if (hasOwnProperty.call(config, 'ref')) {
  2624. var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
  2625. if (getter && getter.isReactWarning) {
  2626. return false;
  2627. }
  2628. }
  2629. }
  2630. return config.ref !== undefined;
  2631. }
  2632. function hasValidKey(config) {
  2633. {
  2634. if (hasOwnProperty.call(config, 'key')) {
  2635. var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
  2636. if (getter && getter.isReactWarning) {
  2637. return false;
  2638. }
  2639. }
  2640. }
  2641. return config.key !== undefined;
  2642. }
  2643. function defineKeyPropWarningGetter(props, displayName) {
  2644. var warnAboutAccessingKey = function () {
  2645. {
  2646. if (!specialPropKeyWarningShown) {
  2647. specialPropKeyWarningShown = true;
  2648. error('%s: `key` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
  2649. }
  2650. }
  2651. };
  2652. warnAboutAccessingKey.isReactWarning = true;
  2653. Object.defineProperty(props, 'key', {
  2654. get: warnAboutAccessingKey,
  2655. configurable: true
  2656. });
  2657. }
  2658. function defineRefPropWarningGetter(props, displayName) {
  2659. var warnAboutAccessingRef = function () {
  2660. {
  2661. if (!specialPropRefWarningShown) {
  2662. specialPropRefWarningShown = true;
  2663. error('%s: `ref` is not a prop. Trying to access it will result ' + 'in `undefined` being returned. If you need to access the same ' + 'value within the child component, you should pass it as a different ' + 'prop. (https://reactjs.org/link/special-props)', displayName);
  2664. }
  2665. }
  2666. };
  2667. warnAboutAccessingRef.isReactWarning = true;
  2668. Object.defineProperty(props, 'ref', {
  2669. get: warnAboutAccessingRef,
  2670. configurable: true
  2671. });
  2672. }
  2673. function warnIfStringRefCannotBeAutoConverted(config) {
  2674. {
  2675. if (typeof config.ref === 'string' && ReactCurrentOwner.current && config.__self && ReactCurrentOwner.current.stateNode !== config.__self) {
  2676. var componentName = getComponentName(ReactCurrentOwner.current.type);
  2677. if (!didWarnAboutStringRefs[componentName]) {
  2678. error('Component "%s" contains the string ref "%s". ' + 'Support for string refs will be removed in a future major release. ' + 'This case cannot be automatically converted to an arrow function. ' + 'We ask you to manually fix this case by using useRef() or createRef() instead. ' + 'Learn more about using refs safely here: ' + 'https://reactjs.org/link/strict-mode-string-ref', componentName, config.ref);
  2679. didWarnAboutStringRefs[componentName] = true;
  2680. }
  2681. }
  2682. }
  2683. }
  2684. /**
  2685. * Factory method to create a new React element. This no longer adheres to
  2686. * the class pattern, so do not use new to call it. Also, instanceof check
  2687. * will not work. Instead test $$typeof field against Symbol.for('react.element') to check
  2688. * if something is a React Element.
  2689. *
  2690. * @param {*} type
  2691. * @param {*} props
  2692. * @param {*} key
  2693. * @param {string|object} ref
  2694. * @param {*} owner
  2695. * @param {*} self A *temporary* helper to detect places where `this` is
  2696. * different from the `owner` when React.createElement is called, so that we
  2697. * can warn. We want to get rid of owner and replace string `ref`s with arrow
  2698. * functions, and as long as `this` and owner are the same, there will be no
  2699. * change in behavior.
  2700. * @param {*} source An annotation object (added by a transpiler or otherwise)
  2701. * indicating filename, line number, and/or other information.
  2702. * @internal
  2703. */
  2704. var ReactElement = function (type, key, ref, self, source, owner, props) {
  2705. var element = {
  2706. // This tag allows us to uniquely identify this as a React Element
  2707. $$typeof: REACT_ELEMENT_TYPE,
  2708. // Built-in properties that belong on the element
  2709. type: type,
  2710. key: key,
  2711. ref: ref,
  2712. props: props,
  2713. // Record the component responsible for creating this element.
  2714. _owner: owner
  2715. };
  2716. {
  2717. // The validation flag is currently mutative. We put it on
  2718. // an external backing store so that we can freeze the whole object.
  2719. // This can be replaced with a WeakMap once they are implemented in
  2720. // commonly used development environments.
  2721. element._store = {}; // To make comparing ReactElements easier for testing purposes, we make
  2722. // the validation flag non-enumerable (where possible, which should
  2723. // include every environment we run tests in), so the test framework
  2724. // ignores it.
  2725. Object.defineProperty(element._store, 'validated', {
  2726. configurable: false,
  2727. enumerable: false,
  2728. writable: true,
  2729. value: false
  2730. }); // self and source are DEV only properties.
  2731. Object.defineProperty(element, '_self', {
  2732. configurable: false,
  2733. enumerable: false,
  2734. writable: false,
  2735. value: self
  2736. }); // Two elements created in two different places should be considered
  2737. // equal for testing purposes and therefore we hide it from enumeration.
  2738. Object.defineProperty(element, '_source', {
  2739. configurable: false,
  2740. enumerable: false,
  2741. writable: false,
  2742. value: source
  2743. });
  2744. if (Object.freeze) {
  2745. Object.freeze(element.props);
  2746. Object.freeze(element);
  2747. }
  2748. }
  2749. return element;
  2750. };
  2751. /**
  2752. * Create and return a new ReactElement of the given type.
  2753. * See https://reactjs.org/docs/react-api.html#createelement
  2754. */
  2755. function createElement(type, config, children) {
  2756. var propName; // Reserved names are extracted
  2757. var props = {};
  2758. var key = null;
  2759. var ref = null;
  2760. var self = null;
  2761. var source = null;
  2762. if (config != null) {
  2763. if (hasValidRef(config)) {
  2764. ref = config.ref;
  2765. {
  2766. warnIfStringRefCannotBeAutoConverted(config);
  2767. }
  2768. }
  2769. if (hasValidKey(config)) {
  2770. key = '' + config.key;
  2771. }
  2772. self = config.__self === undefined ? null : config.__self;
  2773. source = config.__source === undefined ? null : config.__source; // Remaining properties are added to a new props object
  2774. for (propName in config) {
  2775. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2776. props[propName] = config[propName];
  2777. }
  2778. }
  2779. } // Children can be more than one argument, and those are transferred onto
  2780. // the newly allocated props object.
  2781. var childrenLength = arguments.length - 2;
  2782. if (childrenLength === 1) {
  2783. props.children = children;
  2784. } else if (childrenLength > 1) {
  2785. var childArray = Array(childrenLength);
  2786. for (var i = 0; i < childrenLength; i++) {
  2787. childArray[i] = arguments[i + 2];
  2788. }
  2789. {
  2790. if (Object.freeze) {
  2791. Object.freeze(childArray);
  2792. }
  2793. }
  2794. props.children = childArray;
  2795. } // Resolve default props
  2796. if (type && type.defaultProps) {
  2797. var defaultProps = type.defaultProps;
  2798. for (propName in defaultProps) {
  2799. if (props[propName] === undefined) {
  2800. props[propName] = defaultProps[propName];
  2801. }
  2802. }
  2803. }
  2804. {
  2805. if (key || ref) {
  2806. var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;
  2807. if (key) {
  2808. defineKeyPropWarningGetter(props, displayName);
  2809. }
  2810. if (ref) {
  2811. defineRefPropWarningGetter(props, displayName);
  2812. }
  2813. }
  2814. }
  2815. return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);
  2816. }
  2817. function cloneAndReplaceKey(oldElement, newKey) {
  2818. var newElement = ReactElement(oldElement.type, newKey, oldElement.ref, oldElement._self, oldElement._source, oldElement._owner, oldElement.props);
  2819. return newElement;
  2820. }
  2821. /**
  2822. * Clone and return a new ReactElement using element as the starting point.
  2823. * See https://reactjs.org/docs/react-api.html#cloneelement
  2824. */
  2825. function cloneElement(element, config, children) {
  2826. if (!!(element === null || element === undefined)) {
  2827. {
  2828. throw Error( "React.cloneElement(...): The argument must be a React element, but you passed " + element + "." );
  2829. }
  2830. }
  2831. var propName; // Original props are copied
  2832. var props = _assign({}, element.props); // Reserved names are extracted
  2833. var key = element.key;
  2834. var ref = element.ref; // Self is preserved since the owner is preserved.
  2835. var self = element._self; // Source is preserved since cloneElement is unlikely to be targeted by a
  2836. // transpiler, and the original source is probably a better indicator of the
  2837. // true owner.
  2838. var source = element._source; // Owner will be preserved, unless ref is overridden
  2839. var owner = element._owner;
  2840. if (config != null) {
  2841. if (hasValidRef(config)) {
  2842. // Silently steal the ref from the parent.
  2843. ref = config.ref;
  2844. owner = ReactCurrentOwner.current;
  2845. }
  2846. if (hasValidKey(config)) {
  2847. key = '' + config.key;
  2848. } // Remaining properties override existing props
  2849. var defaultProps;
  2850. if (element.type && element.type.defaultProps) {
  2851. defaultProps = element.type.defaultProps;
  2852. }
  2853. for (propName in config) {
  2854. if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {
  2855. if (config[propName] === undefined && defaultProps !== undefined) {
  2856. // Resolve default props
  2857. props[propName] = defaultProps[propName];
  2858. } else {
  2859. props[propName] = config[propName];
  2860. }
  2861. }
  2862. }
  2863. } // Children can be more than one argument, and those are transferred onto
  2864. // the newly allocated props object.
  2865. var childrenLength = arguments.length - 2;
  2866. if (childrenLength === 1) {
  2867. props.children = children;
  2868. } else if (childrenLength > 1) {
  2869. var childArray = Array(childrenLength);
  2870. for (var i = 0; i < childrenLength; i++) {
  2871. childArray[i] = arguments[i + 2];
  2872. }
  2873. props.children = childArray;
  2874. }
  2875. return ReactElement(element.type, key, ref, self, source, owner, props);
  2876. }
  2877. /**
  2878. * Verifies the object is a ReactElement.
  2879. * See https://reactjs.org/docs/react-api.html#isvalidelement
  2880. * @param {?object} object
  2881. * @return {boolean} True if `object` is a ReactElement.
  2882. * @final
  2883. */
  2884. function isValidElement(object) {
  2885. return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
  2886. }
  2887. var SEPARATOR = '.';
  2888. var SUBSEPARATOR = ':';
  2889. /**
  2890. * Escape and wrap key so it is safe to use as a reactid
  2891. *
  2892. * @param {string} key to be escaped.
  2893. * @return {string} the escaped key.
  2894. */
  2895. function escape(key) {
  2896. var escapeRegex = /[=:]/g;
  2897. var escaperLookup = {
  2898. '=': '=0',
  2899. ':': '=2'
  2900. };
  2901. var escapedString = key.replace(escapeRegex, function (match) {
  2902. return escaperLookup[match];
  2903. });
  2904. return '$' + escapedString;
  2905. }
  2906. /**
  2907. * TODO: Test that a single child and an array with one item have the same key
  2908. * pattern.
  2909. */
  2910. var didWarnAboutMaps = false;
  2911. var userProvidedKeyEscapeRegex = /\/+/g;
  2912. function escapeUserProvidedKey(text) {
  2913. return text.replace(userProvidedKeyEscapeRegex, '$&/');
  2914. }
  2915. /**
  2916. * Generate a key string that identifies a element within a set.
  2917. *
  2918. * @param {*} element A element that could contain a manual key.
  2919. * @param {number} index Index that is used if a manual key is not provided.
  2920. * @return {string}
  2921. */
  2922. function getElementKey(element, index) {
  2923. // Do some typechecking here since we call this blindly. We want to ensure
  2924. // that we don't block potential future ES APIs.
  2925. if (typeof element === 'object' && element !== null && element.key != null) {
  2926. // Explicit key
  2927. return escape('' + element.key);
  2928. } // Implicit key determined by the index in the set
  2929. return index.toString(36);
  2930. }
  2931. function mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {
  2932. var type = typeof children;
  2933. if (type === 'undefined' || type === 'boolean') {
  2934. // All of the above are perceived as null.
  2935. children = null;
  2936. }
  2937. var invokeCallback = false;
  2938. if (children === null) {
  2939. invokeCallback = true;
  2940. } else {
  2941. switch (type) {
  2942. case 'string':
  2943. case 'number':
  2944. invokeCallback = true;
  2945. break;
  2946. case 'object':
  2947. switch (children.$$typeof) {
  2948. case REACT_ELEMENT_TYPE:
  2949. case REACT_PORTAL_TYPE:
  2950. invokeCallback = true;
  2951. }
  2952. }
  2953. }
  2954. if (invokeCallback) {
  2955. var _child = children;
  2956. var mappedChild = callback(_child); // If it's the only child, treat the name as if it was wrapped in an array
  2957. // so that it's consistent if the number of children grows:
  2958. var childKey = nameSoFar === '' ? SEPARATOR + getElementKey(_child, 0) : nameSoFar;
  2959. if (Array.isArray(mappedChild)) {
  2960. var escapedChildKey = '';
  2961. if (childKey != null) {
  2962. escapedChildKey = escapeUserProvidedKey(childKey) + '/';
  2963. }
  2964. mapIntoArray(mappedChild, array, escapedChildKey, '', function (c) {
  2965. return c;
  2966. });
  2967. } else if (mappedChild != null) {
  2968. if (isValidElement(mappedChild)) {
  2969. mappedChild = cloneAndReplaceKey(mappedChild, // Keep both the (mapped) and old keys if they differ, just as
  2970. // traverseAllChildren used to do for objects as children
  2971. escapedPrefix + ( // $FlowFixMe Flow incorrectly thinks React.Portal doesn't have a key
  2972. mappedChild.key && (!_child || _child.key !== mappedChild.key) ? // $FlowFixMe Flow incorrectly thinks existing element's key can be a number
  2973. escapeUserProvidedKey('' + mappedChild.key) + '/' : '') + childKey);
  2974. }
  2975. array.push(mappedChild);
  2976. }
  2977. return 1;
  2978. }
  2979. var child;
  2980. var nextName;
  2981. var subtreeCount = 0; // Count of children found in the current subtree.
  2982. var nextNamePrefix = nameSoFar === '' ? SEPARATOR : nameSoFar + SUBSEPARATOR;
  2983. if (Array.isArray(children)) {
  2984. for (var i = 0; i < children.length; i++) {
  2985. child = children[i];
  2986. nextName = nextNamePrefix + getElementKey(child, i);
  2987. subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
  2988. }
  2989. } else {
  2990. var iteratorFn = getIteratorFn(children);
  2991. if (typeof iteratorFn === 'function') {
  2992. var iterableChildren = children;
  2993. {
  2994. // Warn about using Maps as children
  2995. if (iteratorFn === iterableChildren.entries) {
  2996. if (!didWarnAboutMaps) {
  2997. warn('Using Maps as children is not supported. ' + 'Use an array of keyed ReactElements instead.');
  2998. }
  2999. didWarnAboutMaps = true;
  3000. }
  3001. }
  3002. var iterator = iteratorFn.call(iterableChildren);
  3003. var step;
  3004. var ii = 0;
  3005. while (!(step = iterator.next()).done) {
  3006. child = step.value;
  3007. nextName = nextNamePrefix + getElementKey(child, ii++);
  3008. subtreeCount += mapIntoArray(child, array, escapedPrefix, nextName, callback);
  3009. }
  3010. } else if (type === 'object') {
  3011. var childrenString = '' + children;
  3012. {
  3013. {
  3014. throw Error( "Objects are not valid as a React child (found: " + (childrenString === '[object Object]' ? 'object with keys {' + Object.keys(children).join(', ') + '}' : childrenString) + "). If you meant to render a collection of children, use an array instead." );
  3015. }
  3016. }
  3017. }
  3018. }
  3019. return subtreeCount;
  3020. }
  3021. /**
  3022. * Maps children that are typically specified as `props.children`.
  3023. *
  3024. * See https://reactjs.org/docs/react-api.html#reactchildrenmap
  3025. *
  3026. * The provided mapFunction(child, index) will be called for each
  3027. * leaf child.
  3028. *
  3029. * @param {?*} children Children tree container.
  3030. * @param {function(*, int)} func The map function.
  3031. * @param {*} context Context for mapFunction.
  3032. * @return {object} Object containing the ordered map of results.
  3033. */
  3034. function mapChildren(children, func, context) {
  3035. if (children == null) {
  3036. return children;
  3037. }
  3038. var result = [];
  3039. var count = 0;
  3040. mapIntoArray(children, result, '', '', function (child) {
  3041. return func.call(context, child, count++);
  3042. });
  3043. return result;
  3044. }
  3045. /**
  3046. * Count the number of children that are typically specified as
  3047. * `props.children`.
  3048. *
  3049. * See https://reactjs.org/docs/react-api.html#reactchildrencount
  3050. *
  3051. * @param {?*} children Children tree container.
  3052. * @return {number} The number of children.
  3053. */
  3054. function countChildren(children) {
  3055. var n = 0;
  3056. mapChildren(children, function () {
  3057. n++; // Don't return anything
  3058. });
  3059. return n;
  3060. }
  3061. /**
  3062. * Iterates through children that are typically specified as `props.children`.
  3063. *
  3064. * See https://reactjs.org/docs/react-api.html#reactchildrenforeach
  3065. *
  3066. * The provided forEachFunc(child, index) will be called for each
  3067. * leaf child.
  3068. *
  3069. * @param {?*} children Children tree container.
  3070. * @param {function(*, int)} forEachFunc
  3071. * @param {*} forEachContext Context for forEachContext.
  3072. */
  3073. function forEachChildren(children, forEachFunc, forEachContext) {
  3074. mapChildren(children, function () {
  3075. forEachFunc.apply(this, arguments); // Don't return anything.
  3076. }, forEachContext);
  3077. }
  3078. /**
  3079. * Flatten a children object (typically specified as `props.children`) and
  3080. * return an array with appropriately re-keyed children.
  3081. *
  3082. * See https://reactjs.org/docs/react-api.html#reactchildrentoarray
  3083. */
  3084. function toArray(children) {
  3085. return mapChildren(children, function (child) {
  3086. return child;
  3087. }) || [];
  3088. }
  3089. /**
  3090. * Returns the first child in a collection of children and verifies that there
  3091. * is only one child in the collection.
  3092. *
  3093. * See https://reactjs.org/docs/react-api.html#reactchildrenonly
  3094. *
  3095. * The current implementation of this function assumes that a single child gets
  3096. * passed without a wrapper, but the purpose of this helper function is to
  3097. * abstract away the particular structure of children.
  3098. *
  3099. * @param {?object} children Child collection structure.
  3100. * @return {ReactElement} The first and only `ReactElement` contained in the
  3101. * structure.
  3102. */
  3103. function onlyChild(children) {
  3104. if (!isValidElement(children)) {
  3105. {
  3106. throw Error( "React.Children.only expected to receive a single React element child." );
  3107. }
  3108. }
  3109. return children;
  3110. }
  3111. function createContext(defaultValue, calculateChangedBits) {
  3112. if (calculateChangedBits === undefined) {
  3113. calculateChangedBits = null;
  3114. } else {
  3115. {
  3116. if (calculateChangedBits !== null && typeof calculateChangedBits !== 'function') {
  3117. error('createContext: Expected the optional second argument to be a ' + 'function. Instead received: %s', calculateChangedBits);
  3118. }
  3119. }
  3120. }
  3121. var context = {
  3122. $$typeof: REACT_CONTEXT_TYPE,
  3123. _calculateChangedBits: calculateChangedBits,
  3124. // As a workaround to support multiple concurrent renderers, we categorize
  3125. // some renderers as primary and others as secondary. We only expect
  3126. // there to be two concurrent renderers at most: React Native (primary) and
  3127. // Fabric (secondary); React DOM (primary) and React ART (secondary).
  3128. // Secondary renderers store their context values on separate fields.
  3129. _currentValue: defaultValue,
  3130. _currentValue2: defaultValue,
  3131. // Used to track how many concurrent renderers this context currently
  3132. // supports within in a single renderer. Such as parallel server rendering.
  3133. _threadCount: 0,
  3134. // These are circular
  3135. Provider: null,
  3136. Consumer: null
  3137. };
  3138. context.Provider = {
  3139. $$typeof: REACT_PROVIDER_TYPE,
  3140. _context: context
  3141. };
  3142. var hasWarnedAboutUsingNestedContextConsumers = false;
  3143. var hasWarnedAboutUsingConsumerProvider = false;
  3144. var hasWarnedAboutDisplayNameOnConsumer = false;
  3145. {
  3146. // A separate object, but proxies back to the original context object for
  3147. // backwards compatibility. It has a different $$typeof, so we can properly
  3148. // warn for the incorrect usage of Context as a Consumer.
  3149. var Consumer = {
  3150. $$typeof: REACT_CONTEXT_TYPE,
  3151. _context: context,
  3152. _calculateChangedBits: context._calculateChangedBits
  3153. }; // $FlowFixMe: Flow complains about not setting a value, which is intentional here
  3154. Object.defineProperties(Consumer, {
  3155. Provider: {
  3156. get: function () {
  3157. if (!hasWarnedAboutUsingConsumerProvider) {
  3158. hasWarnedAboutUsingConsumerProvider = true;
  3159. error('Rendering <Context.Consumer.Provider> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Provider> instead?');
  3160. }
  3161. return context.Provider;
  3162. },
  3163. set: function (_Provider) {
  3164. context.Provider = _Provider;
  3165. }
  3166. },
  3167. _currentValue: {
  3168. get: function () {
  3169. return context._currentValue;
  3170. },
  3171. set: function (_currentValue) {
  3172. context._currentValue = _currentValue;
  3173. }
  3174. },
  3175. _currentValue2: {
  3176. get: function () {
  3177. return context._currentValue2;
  3178. },
  3179. set: function (_currentValue2) {
  3180. context._currentValue2 = _currentValue2;
  3181. }
  3182. },
  3183. _threadCount: {
  3184. get: function () {
  3185. return context._threadCount;
  3186. },
  3187. set: function (_threadCount) {
  3188. context._threadCount = _threadCount;
  3189. }
  3190. },
  3191. Consumer: {
  3192. get: function () {
  3193. if (!hasWarnedAboutUsingNestedContextConsumers) {
  3194. hasWarnedAboutUsingNestedContextConsumers = true;
  3195. error('Rendering <Context.Consumer.Consumer> is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?');
  3196. }
  3197. return context.Consumer;
  3198. }
  3199. },
  3200. displayName: {
  3201. get: function () {
  3202. return context.displayName;
  3203. },
  3204. set: function (displayName) {
  3205. if (!hasWarnedAboutDisplayNameOnConsumer) {
  3206. warn('Setting `displayName` on Context.Consumer has no effect. ' + "You should set it directly on the context with Context.displayName = '%s'.", displayName);
  3207. hasWarnedAboutDisplayNameOnConsumer = true;
  3208. }
  3209. }
  3210. }
  3211. }); // $FlowFixMe: Flow complains about missing properties because it doesn't understand defineProperty
  3212. context.Consumer = Consumer;
  3213. }
  3214. {
  3215. context._currentRenderer = null;
  3216. context._currentRenderer2 = null;
  3217. }
  3218. return context;
  3219. }
  3220. var Uninitialized = -1;
  3221. var Pending = 0;
  3222. var Resolved = 1;
  3223. var Rejected = 2;
  3224. function lazyInitializer(payload) {
  3225. if (payload._status === Uninitialized) {
  3226. var ctor = payload._result;
  3227. var thenable = ctor(); // Transition to the next state.
  3228. var pending = payload;
  3229. pending._status = Pending;
  3230. pending._result = thenable;
  3231. thenable.then(function (moduleObject) {
  3232. if (payload._status === Pending) {
  3233. var defaultExport = moduleObject.default;
  3234. {
  3235. if (defaultExport === undefined) {
  3236. error('lazy: Expected the result of a dynamic import() call. ' + 'Instead received: %s\n\nYour code should look like: \n ' + // Break up imports to avoid accidentally parsing them as dependencies.
  3237. 'const MyComponent = lazy(() => imp' + "ort('./MyComponent'))", moduleObject);
  3238. }
  3239. } // Transition to the next state.
  3240. var resolved = payload;
  3241. resolved._status = Resolved;
  3242. resolved._result = defaultExport;
  3243. }
  3244. }, function (error) {
  3245. if (payload._status === Pending) {
  3246. // Transition to the next state.
  3247. var rejected = payload;
  3248. rejected._status = Rejected;
  3249. rejected._result = error;
  3250. }
  3251. });
  3252. }
  3253. if (payload._status === Resolved) {
  3254. return payload._result;
  3255. } else {
  3256. throw payload._result;
  3257. }
  3258. }
  3259. function lazy(ctor) {
  3260. var payload = {
  3261. // We use these fields to store the result.
  3262. _status: -1,
  3263. _result: ctor
  3264. };
  3265. var lazyType = {
  3266. $$typeof: REACT_LAZY_TYPE,
  3267. _payload: payload,
  3268. _init: lazyInitializer
  3269. };
  3270. {
  3271. // In production, this would just set it on the object.
  3272. var defaultProps;
  3273. var propTypes; // $FlowFixMe
  3274. Object.defineProperties(lazyType, {
  3275. defaultProps: {
  3276. configurable: true,
  3277. get: function () {
  3278. return defaultProps;
  3279. },
  3280. set: function (newDefaultProps) {
  3281. error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
  3282. defaultProps = newDefaultProps; // Match production behavior more closely:
  3283. // $FlowFixMe
  3284. Object.defineProperty(lazyType, 'defaultProps', {
  3285. enumerable: true
  3286. });
  3287. }
  3288. },
  3289. propTypes: {
  3290. configurable: true,
  3291. get: function () {
  3292. return propTypes;
  3293. },
  3294. set: function (newPropTypes) {
  3295. error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.');
  3296. propTypes = newPropTypes; // Match production behavior more closely:
  3297. // $FlowFixMe
  3298. Object.defineProperty(lazyType, 'propTypes', {
  3299. enumerable: true
  3300. });
  3301. }
  3302. }
  3303. });
  3304. }
  3305. return lazyType;
  3306. }
  3307. function forwardRef(render) {
  3308. {
  3309. if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
  3310. error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).');
  3311. } else if (typeof render !== 'function') {
  3312. error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render);
  3313. } else {
  3314. if (render.length !== 0 && render.length !== 2) {
  3315. error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.');
  3316. }
  3317. }
  3318. if (render != null) {
  3319. if (render.defaultProps != null || render.propTypes != null) {
  3320. error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
  3321. }
  3322. }
  3323. }
  3324. var elementType = {
  3325. $$typeof: REACT_FORWARD_REF_TYPE,
  3326. render: render
  3327. };
  3328. {
  3329. var ownName;
  3330. Object.defineProperty(elementType, 'displayName', {
  3331. enumerable: false,
  3332. configurable: true,
  3333. get: function () {
  3334. return ownName;
  3335. },
  3336. set: function (name) {
  3337. ownName = name;
  3338. if (render.displayName == null) {
  3339. render.displayName = name;
  3340. }
  3341. }
  3342. });
  3343. }
  3344. return elementType;
  3345. }
  3346. // Filter certain DOM attributes (e.g. src, href) if their values are empty strings.
  3347. var enableScopeAPI = false; // Experimental Create Event Handle API.
  3348. function isValidElementType(type) {
  3349. if (typeof type === 'string' || typeof type === 'function') {
  3350. return true;
  3351. } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
  3352. if (type === exports.Fragment || type === exports.Profiler || type === REACT_DEBUG_TRACING_MODE_TYPE || type === exports.StrictMode || type === exports.Suspense || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
  3353. return true;
  3354. }
  3355. if (typeof type === 'object' && type !== null) {
  3356. if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
  3357. return true;
  3358. }
  3359. }
  3360. return false;
  3361. }
  3362. function memo(type, compare) {
  3363. {
  3364. if (!isValidElementType(type)) {
  3365. error('memo: The first argument must be a component. Instead ' + 'received: %s', type === null ? 'null' : typeof type);
  3366. }
  3367. }
  3368. var elementType = {
  3369. $$typeof: REACT_MEMO_TYPE,
  3370. type: type,
  3371. compare: compare === undefined ? null : compare
  3372. };
  3373. {
  3374. var ownName;
  3375. Object.defineProperty(elementType, 'displayName', {
  3376. enumerable: false,
  3377. configurable: true,
  3378. get: function () {
  3379. return ownName;
  3380. },
  3381. set: function (name) {
  3382. ownName = name;
  3383. if (type.displayName == null) {
  3384. type.displayName = name;
  3385. }
  3386. }
  3387. });
  3388. }
  3389. return elementType;
  3390. }
  3391. function resolveDispatcher() {
  3392. var dispatcher = ReactCurrentDispatcher.current;
  3393. if (!(dispatcher !== null)) {
  3394. {
  3395. throw Error( "Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:\n1. You might have mismatching versions of React and the renderer (such as React DOM)\n2. You might be breaking the Rules of Hooks\n3. You might have more than one copy of React in the same app\nSee https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem." );
  3396. }
  3397. }
  3398. return dispatcher;
  3399. }
  3400. function useContext(Context, unstable_observedBits) {
  3401. var dispatcher = resolveDispatcher();
  3402. {
  3403. if (unstable_observedBits !== undefined) {
  3404. error('useContext() second argument is reserved for future ' + 'use in React. Passing it is not supported. ' + 'You passed: %s.%s', unstable_observedBits, typeof unstable_observedBits === 'number' && Array.isArray(arguments[2]) ? '\n\nDid you call array.map(useContext)? ' + 'Calling Hooks inside a loop is not supported. ' + 'Learn more at https://reactjs.org/link/rules-of-hooks' : '');
  3405. } // TODO: add a more generic warning for invalid values.
  3406. if (Context._context !== undefined) {
  3407. var realContext = Context._context; // Don't deduplicate because this legitimately causes bugs
  3408. // and nobody should be using this in existing code.
  3409. if (realContext.Consumer === Context) {
  3410. error('Calling useContext(Context.Consumer) is not supported, may cause bugs, and will be ' + 'removed in a future major release. Did you mean to call useContext(Context) instead?');
  3411. } else if (realContext.Provider === Context) {
  3412. error('Calling useContext(Context.Provider) is not supported. ' + 'Did you mean to call useContext(Context) instead?');
  3413. }
  3414. }
  3415. }
  3416. return dispatcher.useContext(Context, unstable_observedBits);
  3417. }
  3418. function useState(initialState) {
  3419. var dispatcher = resolveDispatcher();
  3420. return dispatcher.useState(initialState);
  3421. }
  3422. function useReducer(reducer, initialArg, init) {
  3423. var dispatcher = resolveDispatcher();
  3424. return dispatcher.useReducer(reducer, initialArg, init);
  3425. }
  3426. function useRef(initialValue) {
  3427. var dispatcher = resolveDispatcher();
  3428. return dispatcher.useRef(initialValue);
  3429. }
  3430. function useEffect(create, deps) {
  3431. var dispatcher = resolveDispatcher();
  3432. return dispatcher.useEffect(create, deps);
  3433. }
  3434. function useLayoutEffect(create, deps) {
  3435. var dispatcher = resolveDispatcher();
  3436. return dispatcher.useLayoutEffect(create, deps);
  3437. }
  3438. function useCallback(callback, deps) {
  3439. var dispatcher = resolveDispatcher();
  3440. return dispatcher.useCallback(callback, deps);
  3441. }
  3442. function useMemo(create, deps) {
  3443. var dispatcher = resolveDispatcher();
  3444. return dispatcher.useMemo(create, deps);
  3445. }
  3446. function useImperativeHandle(ref, create, deps) {
  3447. var dispatcher = resolveDispatcher();
  3448. return dispatcher.useImperativeHandle(ref, create, deps);
  3449. }
  3450. function useDebugValue(value, formatterFn) {
  3451. {
  3452. var dispatcher = resolveDispatcher();
  3453. return dispatcher.useDebugValue(value, formatterFn);
  3454. }
  3455. }
  3456. // Helpers to patch console.logs to avoid logging during side-effect free
  3457. // replaying on render function. This currently only patches the object
  3458. // lazily which won't cover if the log function was extracted eagerly.
  3459. // We could also eagerly patch the method.
  3460. var disabledDepth = 0;
  3461. var prevLog;
  3462. var prevInfo;
  3463. var prevWarn;
  3464. var prevError;
  3465. var prevGroup;
  3466. var prevGroupCollapsed;
  3467. var prevGroupEnd;
  3468. function disabledLog() {}
  3469. disabledLog.__reactDisabledLog = true;
  3470. function disableLogs() {
  3471. {
  3472. if (disabledDepth === 0) {
  3473. /* eslint-disable react-internal/no-production-logging */
  3474. prevLog = console.log;
  3475. prevInfo = console.info;
  3476. prevWarn = console.warn;
  3477. prevError = console.error;
  3478. prevGroup = console.group;
  3479. prevGroupCollapsed = console.groupCollapsed;
  3480. prevGroupEnd = console.groupEnd; // https://github.com/facebook/react/issues/19099
  3481. var props = {
  3482. configurable: true,
  3483. enumerable: true,
  3484. value: disabledLog,
  3485. writable: true
  3486. }; // $FlowFixMe Flow thinks console is immutable.
  3487. Object.defineProperties(console, {
  3488. info: props,
  3489. log: props,
  3490. warn: props,
  3491. error: props,
  3492. group: props,
  3493. groupCollapsed: props,
  3494. groupEnd: props
  3495. });
  3496. /* eslint-enable react-internal/no-production-logging */
  3497. }
  3498. disabledDepth++;
  3499. }
  3500. }
  3501. function reenableLogs() {
  3502. {
  3503. disabledDepth--;
  3504. if (disabledDepth === 0) {
  3505. /* eslint-disable react-internal/no-production-logging */
  3506. var props = {
  3507. configurable: true,
  3508. enumerable: true,
  3509. writable: true
  3510. }; // $FlowFixMe Flow thinks console is immutable.
  3511. Object.defineProperties(console, {
  3512. log: _assign({}, props, {
  3513. value: prevLog
  3514. }),
  3515. info: _assign({}, props, {
  3516. value: prevInfo
  3517. }),
  3518. warn: _assign({}, props, {
  3519. value: prevWarn
  3520. }),
  3521. error: _assign({}, props, {
  3522. value: prevError
  3523. }),
  3524. group: _assign({}, props, {
  3525. value: prevGroup
  3526. }),
  3527. groupCollapsed: _assign({}, props, {
  3528. value: prevGroupCollapsed
  3529. }),
  3530. groupEnd: _assign({}, props, {
  3531. value: prevGroupEnd
  3532. })
  3533. });
  3534. /* eslint-enable react-internal/no-production-logging */
  3535. }
  3536. if (disabledDepth < 0) {
  3537. error('disabledDepth fell below zero. ' + 'This is a bug in React. Please file an issue.');
  3538. }
  3539. }
  3540. }
  3541. var ReactCurrentDispatcher$1 = ReactSharedInternals.ReactCurrentDispatcher;
  3542. var prefix;
  3543. function describeBuiltInComponentFrame(name, source, ownerFn) {
  3544. {
  3545. if (prefix === undefined) {
  3546. // Extract the VM specific prefix used by each line.
  3547. try {
  3548. throw Error();
  3549. } catch (x) {
  3550. var match = x.stack.trim().match(/\n( *(at )?)/);
  3551. prefix = match && match[1] || '';
  3552. }
  3553. } // We use the prefix to ensure our stacks line up with native stack frames.
  3554. return '\n' + prefix + name;
  3555. }
  3556. }
  3557. var reentry = false;
  3558. var componentFrameCache;
  3559. {
  3560. var PossiblyWeakMap = typeof WeakMap === 'function' ? WeakMap : Map;
  3561. componentFrameCache = new PossiblyWeakMap();
  3562. }
  3563. function describeNativeComponentFrame(fn, construct) {
  3564. // If something asked for a stack inside a fake render, it should get ignored.
  3565. if (!fn || reentry) {
  3566. return '';
  3567. }
  3568. {
  3569. var frame = componentFrameCache.get(fn);
  3570. if (frame !== undefined) {
  3571. return frame;
  3572. }
  3573. }
  3574. var control;
  3575. reentry = true;
  3576. var previousPrepareStackTrace = Error.prepareStackTrace; // $FlowFixMe It does accept undefined.
  3577. Error.prepareStackTrace = undefined;
  3578. var previousDispatcher;
  3579. {
  3580. previousDispatcher = ReactCurrentDispatcher$1.current; // Set the dispatcher in DEV because this might be call in the render function
  3581. // for warnings.
  3582. ReactCurrentDispatcher$1.current = null;
  3583. disableLogs();
  3584. }
  3585. try {
  3586. // This should throw.
  3587. if (construct) {
  3588. // Something should be setting the props in the constructor.
  3589. var Fake = function () {
  3590. throw Error();
  3591. }; // $FlowFixMe
  3592. Object.defineProperty(Fake.prototype, 'props', {
  3593. set: function () {
  3594. // We use a throwing setter instead of frozen or non-writable props
  3595. // because that won't throw in a non-strict mode function.
  3596. throw Error();
  3597. }
  3598. });
  3599. if (typeof Reflect === 'object' && Reflect.construct) {
  3600. // We construct a different control for this case to include any extra
  3601. // frames added by the construct call.
  3602. try {
  3603. Reflect.construct(Fake, []);
  3604. } catch (x) {
  3605. control = x;
  3606. }
  3607. Reflect.construct(fn, [], Fake);
  3608. } else {
  3609. try {
  3610. Fake.call();
  3611. } catch (x) {
  3612. control = x;
  3613. }
  3614. fn.call(Fake.prototype);
  3615. }
  3616. } else {
  3617. try {
  3618. throw Error();
  3619. } catch (x) {
  3620. control = x;
  3621. }
  3622. fn();
  3623. }
  3624. } catch (sample) {
  3625. // This is inlined manually because closure doesn't do it for us.
  3626. if (sample && control && typeof sample.stack === 'string') {
  3627. // This extracts the first frame from the sample that isn't also in the control.
  3628. // Skipping one frame that we assume is the frame that calls the two.
  3629. var sampleLines = sample.stack.split('\n');
  3630. var controlLines = control.stack.split('\n');
  3631. var s = sampleLines.length - 1;
  3632. var c = controlLines.length - 1;
  3633. while (s >= 1 && c >= 0 && sampleLines[s] !== controlLines[c]) {
  3634. // We expect at least one stack frame to be shared.
  3635. // Typically this will be the root most one. However, stack frames may be
  3636. // cut off due to maximum stack limits. In this case, one maybe cut off
  3637. // earlier than the other. We assume that the sample is longer or the same
  3638. // and there for cut off earlier. So we should find the root most frame in
  3639. // the sample somewhere in the control.
  3640. c--;
  3641. }
  3642. for (; s >= 1 && c >= 0; s--, c--) {
  3643. // Next we find the first one that isn't the same which should be the
  3644. // frame that called our sample function and the control.
  3645. if (sampleLines[s] !== controlLines[c]) {
  3646. // In V8, the first line is describing the message but other VMs don't.
  3647. // If we're about to return the first line, and the control is also on the same
  3648. // line, that's a pretty good indicator that our sample threw at same line as
  3649. // the control. I.e. before we entered the sample frame. So we ignore this result.
  3650. // This can happen if you passed a class to function component, or non-function.
  3651. if (s !== 1 || c !== 1) {
  3652. do {
  3653. s--;
  3654. c--; // We may still have similar intermediate frames from the construct call.
  3655. // The next one that isn't the same should be our match though.
  3656. if (c < 0 || sampleLines[s] !== controlLines[c]) {
  3657. // V8 adds a "new" prefix for native classes. Let's remove it to make it prettier.
  3658. var _frame = '\n' + sampleLines[s].replace(' at new ', ' at ');
  3659. {
  3660. if (typeof fn === 'function') {
  3661. componentFrameCache.set(fn, _frame);
  3662. }
  3663. } // Return the line we found.
  3664. return _frame;
  3665. }
  3666. } while (s >= 1 && c >= 0);
  3667. }
  3668. break;
  3669. }
  3670. }
  3671. }
  3672. } finally {
  3673. reentry = false;
  3674. {
  3675. ReactCurrentDispatcher$1.current = previousDispatcher;
  3676. reenableLogs();
  3677. }
  3678. Error.prepareStackTrace = previousPrepareStackTrace;
  3679. } // Fallback to just using the name if we couldn't make it throw.
  3680. var name = fn ? fn.displayName || fn.name : '';
  3681. var syntheticFrame = name ? describeBuiltInComponentFrame(name) : '';
  3682. {
  3683. if (typeof fn === 'function') {
  3684. componentFrameCache.set(fn, syntheticFrame);
  3685. }
  3686. }
  3687. return syntheticFrame;
  3688. }
  3689. function describeFunctionComponentFrame(fn, source, ownerFn) {
  3690. {
  3691. return describeNativeComponentFrame(fn, false);
  3692. }
  3693. }
  3694. function shouldConstruct(Component) {
  3695. var prototype = Component.prototype;
  3696. return !!(prototype && prototype.isReactComponent);
  3697. }
  3698. function describeUnknownElementTypeFrameInDEV(type, source, ownerFn) {
  3699. if (type == null) {
  3700. return '';
  3701. }
  3702. if (typeof type === 'function') {
  3703. {
  3704. return describeNativeComponentFrame(type, shouldConstruct(type));
  3705. }
  3706. }
  3707. if (typeof type === 'string') {
  3708. return describeBuiltInComponentFrame(type);
  3709. }
  3710. switch (type) {
  3711. case exports.Suspense:
  3712. return describeBuiltInComponentFrame('Suspense');
  3713. case REACT_SUSPENSE_LIST_TYPE:
  3714. return describeBuiltInComponentFrame('SuspenseList');
  3715. }
  3716. if (typeof type === 'object') {
  3717. switch (type.$$typeof) {
  3718. case REACT_FORWARD_REF_TYPE:
  3719. return describeFunctionComponentFrame(type.render);
  3720. case REACT_MEMO_TYPE:
  3721. // Memo may contain any component type so we recursively resolve it.
  3722. return describeUnknownElementTypeFrameInDEV(type.type, source, ownerFn);
  3723. case REACT_BLOCK_TYPE:
  3724. return describeFunctionComponentFrame(type._render);
  3725. case REACT_LAZY_TYPE:
  3726. {
  3727. var lazyComponent = type;
  3728. var payload = lazyComponent._payload;
  3729. var init = lazyComponent._init;
  3730. try {
  3731. // Lazy may contain any component type so we recursively resolve it.
  3732. return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
  3733. } catch (x) {}
  3734. }
  3735. }
  3736. }
  3737. return '';
  3738. }
  3739. var loggedTypeFailures = {};
  3740. var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
  3741. function setCurrentlyValidatingElement(element) {
  3742. {
  3743. if (element) {
  3744. var owner = element._owner;
  3745. var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
  3746. ReactDebugCurrentFrame$1.setExtraStackFrame(stack);
  3747. } else {
  3748. ReactDebugCurrentFrame$1.setExtraStackFrame(null);
  3749. }
  3750. }
  3751. }
  3752. function checkPropTypes(typeSpecs, values, location, componentName, element) {
  3753. {
  3754. // $FlowFixMe This is okay but Flow doesn't know it.
  3755. var has = Function.call.bind(Object.prototype.hasOwnProperty);
  3756. for (var typeSpecName in typeSpecs) {
  3757. if (has(typeSpecs, typeSpecName)) {
  3758. var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
  3759. // fail the render phase where it didn't fail before. So we log it.
  3760. // After these have been cleaned up, we'll let them throw.
  3761. try {
  3762. // This is intentionally an invariant that gets caught. It's the same
  3763. // behavior as without this statement except with a better message.
  3764. if (typeof typeSpecs[typeSpecName] !== 'function') {
  3765. var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
  3766. err.name = 'Invariant Violation';
  3767. throw err;
  3768. }
  3769. error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');
  3770. } catch (ex) {
  3771. error$1 = ex;
  3772. }
  3773. if (error$1 && !(error$1 instanceof Error)) {
  3774. setCurrentlyValidatingElement(element);
  3775. error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
  3776. setCurrentlyValidatingElement(null);
  3777. }
  3778. if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {
  3779. // Only monitor this failure once because there tends to be a lot of the
  3780. // same error.
  3781. loggedTypeFailures[error$1.message] = true;
  3782. setCurrentlyValidatingElement(element);
  3783. error('Failed %s type: %s', location, error$1.message);
  3784. setCurrentlyValidatingElement(null);
  3785. }
  3786. }
  3787. }
  3788. }
  3789. }
  3790. function setCurrentlyValidatingElement$1(element) {
  3791. {
  3792. if (element) {
  3793. var owner = element._owner;
  3794. var stack = describeUnknownElementTypeFrameInDEV(element.type, element._source, owner ? owner.type : null);
  3795. setExtraStackFrame(stack);
  3796. } else {
  3797. setExtraStackFrame(null);
  3798. }
  3799. }
  3800. }
  3801. var propTypesMisspellWarningShown;
  3802. {
  3803. propTypesMisspellWarningShown = false;
  3804. }
  3805. function getDeclarationErrorAddendum() {
  3806. if (ReactCurrentOwner.current) {
  3807. var name = getComponentName(ReactCurrentOwner.current.type);
  3808. if (name) {
  3809. return '\n\nCheck the render method of `' + name + '`.';
  3810. }
  3811. }
  3812. return '';
  3813. }
  3814. function getSourceInfoErrorAddendum(source) {
  3815. if (source !== undefined) {
  3816. var fileName = source.fileName.replace(/^.*[\\\/]/, '');
  3817. var lineNumber = source.lineNumber;
  3818. return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
  3819. }
  3820. return '';
  3821. }
  3822. function getSourceInfoErrorAddendumForProps(elementProps) {
  3823. if (elementProps !== null && elementProps !== undefined) {
  3824. return getSourceInfoErrorAddendum(elementProps.__source);
  3825. }
  3826. return '';
  3827. }
  3828. /**
  3829. * Warn if there's no key explicitly set on dynamic arrays of children or
  3830. * object keys are not valid. This allows us to keep track of children between
  3831. * updates.
  3832. */
  3833. var ownerHasKeyUseWarning = {};
  3834. function getCurrentComponentErrorInfo(parentType) {
  3835. var info = getDeclarationErrorAddendum();
  3836. if (!info) {
  3837. var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;
  3838. if (parentName) {
  3839. info = "\n\nCheck the top-level render call using <" + parentName + ">.";
  3840. }
  3841. }
  3842. return info;
  3843. }
  3844. /**
  3845. * Warn if the element doesn't have an explicit key assigned to it.
  3846. * This element is in an array. The array could grow and shrink or be
  3847. * reordered. All children that haven't already been validated are required to
  3848. * have a "key" property assigned to it. Error statuses are cached so a warning
  3849. * will only be shown once.
  3850. *
  3851. * @internal
  3852. * @param {ReactElement} element Element that requires a key.
  3853. * @param {*} parentType element's parent's type.
  3854. */
  3855. function validateExplicitKey(element, parentType) {
  3856. if (!element._store || element._store.validated || element.key != null) {
  3857. return;
  3858. }
  3859. element._store.validated = true;
  3860. var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);
  3861. if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {
  3862. return;
  3863. }
  3864. ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a
  3865. // property, it may be the creator of the child that's responsible for
  3866. // assigning it a key.
  3867. var childOwner = '';
  3868. if (element && element._owner && element._owner !== ReactCurrentOwner.current) {
  3869. // Give the component that originally created this child.
  3870. childOwner = " It was passed a child from " + getComponentName(element._owner.type) + ".";
  3871. }
  3872. {
  3873. setCurrentlyValidatingElement$1(element);
  3874. error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);
  3875. setCurrentlyValidatingElement$1(null);
  3876. }
  3877. }
  3878. /**
  3879. * Ensure that every element either is passed in a static location, in an
  3880. * array with an explicit keys property defined, or in an object literal
  3881. * with valid key property.
  3882. *
  3883. * @internal
  3884. * @param {ReactNode} node Statically passed child of any type.
  3885. * @param {*} parentType node's parent's type.
  3886. */
  3887. function validateChildKeys(node, parentType) {
  3888. if (typeof node !== 'object') {
  3889. return;
  3890. }
  3891. if (Array.isArray(node)) {
  3892. for (var i = 0; i < node.length; i++) {
  3893. var child = node[i];
  3894. if (isValidElement(child)) {
  3895. validateExplicitKey(child, parentType);
  3896. }
  3897. }
  3898. } else if (isValidElement(node)) {
  3899. // This element was passed in a valid location.
  3900. if (node._store) {
  3901. node._store.validated = true;
  3902. }
  3903. } else if (node) {
  3904. var iteratorFn = getIteratorFn(node);
  3905. if (typeof iteratorFn === 'function') {
  3906. // Entry iterators used to provide implicit keys,
  3907. // but now we print a separate warning for them later.
  3908. if (iteratorFn !== node.entries) {
  3909. var iterator = iteratorFn.call(node);
  3910. var step;
  3911. while (!(step = iterator.next()).done) {
  3912. if (isValidElement(step.value)) {
  3913. validateExplicitKey(step.value, parentType);
  3914. }
  3915. }
  3916. }
  3917. }
  3918. }
  3919. }
  3920. /**
  3921. * Given an element, validate that its props follow the propTypes definition,
  3922. * provided by the type.
  3923. *
  3924. * @param {ReactElement} element
  3925. */
  3926. function validatePropTypes(element) {
  3927. {
  3928. var type = element.type;
  3929. if (type === null || type === undefined || typeof type === 'string') {
  3930. return;
  3931. }
  3932. var propTypes;
  3933. if (typeof type === 'function') {
  3934. propTypes = type.propTypes;
  3935. } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.
  3936. // Inner props are checked in the reconciler.
  3937. type.$$typeof === REACT_MEMO_TYPE)) {
  3938. propTypes = type.propTypes;
  3939. } else {
  3940. return;
  3941. }
  3942. if (propTypes) {
  3943. // Intentionally inside to avoid triggering lazy initializers:
  3944. var name = getComponentName(type);
  3945. checkPropTypes(propTypes, element.props, 'prop', name, element);
  3946. } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {
  3947. propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:
  3948. var _name = getComponentName(type);
  3949. error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');
  3950. }
  3951. if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {
  3952. error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');
  3953. }
  3954. }
  3955. }
  3956. /**
  3957. * Given a fragment, validate that it can only be provided with fragment props
  3958. * @param {ReactElement} fragment
  3959. */
  3960. function validateFragmentProps(fragment) {
  3961. {
  3962. var keys = Object.keys(fragment.props);
  3963. for (var i = 0; i < keys.length; i++) {
  3964. var key = keys[i];
  3965. if (key !== 'children' && key !== 'key') {
  3966. setCurrentlyValidatingElement$1(fragment);
  3967. error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);
  3968. setCurrentlyValidatingElement$1(null);
  3969. break;
  3970. }
  3971. }
  3972. if (fragment.ref !== null) {
  3973. setCurrentlyValidatingElement$1(fragment);
  3974. error('Invalid attribute `ref` supplied to `React.Fragment`.');
  3975. setCurrentlyValidatingElement$1(null);
  3976. }
  3977. }
  3978. }
  3979. function createElementWithValidation(type, props, children) {
  3980. var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to
  3981. // succeed and there will likely be errors in render.
  3982. if (!validType) {
  3983. var info = '';
  3984. if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {
  3985. info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";
  3986. }
  3987. var sourceInfo = getSourceInfoErrorAddendumForProps(props);
  3988. if (sourceInfo) {
  3989. info += sourceInfo;
  3990. } else {
  3991. info += getDeclarationErrorAddendum();
  3992. }
  3993. var typeString;
  3994. if (type === null) {
  3995. typeString = 'null';
  3996. } else if (Array.isArray(type)) {
  3997. typeString = 'array';
  3998. } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
  3999. typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";
  4000. info = ' Did you accidentally export a JSX literal instead of a component?';
  4001. } else {
  4002. typeString = typeof type;
  4003. }
  4004. {
  4005. error('React.createElement: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);
  4006. }
  4007. }
  4008. var element = createElement.apply(this, arguments); // The result can be nullish if a mock or a custom function is used.
  4009. // TODO: Drop this when these are no longer allowed as the type argument.
  4010. if (element == null) {
  4011. return element;
  4012. } // Skip key warning if the type isn't valid since our key validation logic
  4013. // doesn't expect a non-string/function type and can throw confusing errors.
  4014. // We don't want exception behavior to differ between dev and prod.
  4015. // (Rendering will throw with a helpful message and as soon as the type is
  4016. // fixed, the key warnings will appear.)
  4017. if (validType) {
  4018. for (var i = 2; i < arguments.length; i++) {
  4019. validateChildKeys(arguments[i], type);
  4020. }
  4021. }
  4022. if (type === exports.Fragment) {
  4023. validateFragmentProps(element);
  4024. } else {
  4025. validatePropTypes(element);
  4026. }
  4027. return element;
  4028. }
  4029. var didWarnAboutDeprecatedCreateFactory = false;
  4030. function createFactoryWithValidation(type) {
  4031. var validatedFactory = createElementWithValidation.bind(null, type);
  4032. validatedFactory.type = type;
  4033. {
  4034. if (!didWarnAboutDeprecatedCreateFactory) {
  4035. didWarnAboutDeprecatedCreateFactory = true;
  4036. warn('React.createFactory() is deprecated and will be removed in ' + 'a future major release. Consider using JSX ' + 'or use React.createElement() directly instead.');
  4037. } // Legacy hook: remove it
  4038. Object.defineProperty(validatedFactory, 'type', {
  4039. enumerable: false,
  4040. get: function () {
  4041. warn('Factory.type is deprecated. Access the class directly ' + 'before passing it to createFactory.');
  4042. Object.defineProperty(this, 'type', {
  4043. value: type
  4044. });
  4045. return type;
  4046. }
  4047. });
  4048. }
  4049. return validatedFactory;
  4050. }
  4051. function cloneElementWithValidation(element, props, children) {
  4052. var newElement = cloneElement.apply(this, arguments);
  4053. for (var i = 2; i < arguments.length; i++) {
  4054. validateChildKeys(arguments[i], newElement.type);
  4055. }
  4056. validatePropTypes(newElement);
  4057. return newElement;
  4058. }
  4059. {
  4060. try {
  4061. var frozenObject = Object.freeze({});
  4062. /* eslint-disable no-new */
  4063. new Map([[frozenObject, null]]);
  4064. new Set([frozenObject]);
  4065. /* eslint-enable no-new */
  4066. } catch (e) {
  4067. }
  4068. }
  4069. var createElement$1 = createElementWithValidation ;
  4070. var cloneElement$1 = cloneElementWithValidation ;
  4071. var createFactory = createFactoryWithValidation ;
  4072. var Children = {
  4073. map: mapChildren,
  4074. forEach: forEachChildren,
  4075. count: countChildren,
  4076. toArray: toArray,
  4077. only: onlyChild
  4078. };
  4079. exports.Children = Children;
  4080. exports.Component = Component;
  4081. exports.PureComponent = PureComponent;
  4082. exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals;
  4083. exports.cloneElement = cloneElement$1;
  4084. exports.createContext = createContext;
  4085. exports.createElement = createElement$1;
  4086. exports.createFactory = createFactory;
  4087. exports.createRef = createRef;
  4088. exports.forwardRef = forwardRef;
  4089. exports.isValidElement = isValidElement;
  4090. exports.lazy = lazy;
  4091. exports.memo = memo;
  4092. exports.useCallback = useCallback;
  4093. exports.useContext = useContext;
  4094. exports.useDebugValue = useDebugValue;
  4095. exports.useEffect = useEffect;
  4096. exports.useImperativeHandle = useImperativeHandle;
  4097. exports.useLayoutEffect = useLayoutEffect;
  4098. exports.useMemo = useMemo;
  4099. exports.useReducer = useReducer;
  4100. exports.useRef = useRef;
  4101. exports.useState = useState;
  4102. exports.version = ReactVersion;
  4103. })();
  4104. }
  4105. /***/ }),
  4106. /***/ "./node_modules/react/index.js":
  4107. /*!*************************************!*\
  4108. !*** ./node_modules/react/index.js ***!
  4109. \*************************************/
  4110. /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
  4111. "use strict";
  4112. if (false) {} else {
  4113. module.exports = __webpack_require__(/*! ./cjs/react.development.js */ "./node_modules/react/cjs/react.development.js");
  4114. }
  4115. /***/ }),
  4116. /***/ "./node_modules/@babel/runtime/helpers/esm/defineProperty.js":
  4117. /*!*******************************************************************!*\
  4118. !*** ./node_modules/@babel/runtime/helpers/esm/defineProperty.js ***!
  4119. \*******************************************************************/
  4120. /***/ (function(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
  4121. "use strict";
  4122. __webpack_require__.r(__webpack_exports__);
  4123. /* harmony export */ __webpack_require__.d(__webpack_exports__, {
  4124. /* harmony export */ "default": function() { return /* binding */ _defineProperty; }
  4125. /* harmony export */ });
  4126. function _defineProperty(obj, key, value) {
  4127. if (key in obj) {
  4128. Object.defineProperty(obj, key, {
  4129. value: value,
  4130. enumerable: true,
  4131. configurable: true,
  4132. writable: true
  4133. });
  4134. } else {
  4135. obj[key] = value;
  4136. }
  4137. return obj;
  4138. }
  4139. /***/ })
  4140. /******/ });
  4141. /************************************************************************/
  4142. /******/ // The module cache
  4143. /******/ var __webpack_module_cache__ = {};
  4144. /******/
  4145. /******/ // The require function
  4146. /******/ function __webpack_require__(moduleId) {
  4147. /******/ // Check if module is in cache
  4148. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  4149. /******/ if (cachedModule !== undefined) {
  4150. /******/ return cachedModule.exports;
  4151. /******/ }
  4152. /******/ // Create a new module (and put it into the cache)
  4153. /******/ var module = __webpack_module_cache__[moduleId] = {
  4154. /******/ // no module.id needed
  4155. /******/ // no module.loaded needed
  4156. /******/ exports: {}
  4157. /******/ };
  4158. /******/
  4159. /******/ // Execute the module function
  4160. /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
  4161. /******/
  4162. /******/ // Return the exports of the module
  4163. /******/ return module.exports;
  4164. /******/ }
  4165. /******/
  4166. /************************************************************************/
  4167. /******/ /* webpack/runtime/compat get default export */
  4168. /******/ !function() {
  4169. /******/ // getDefaultExport function for compatibility with non-harmony modules
  4170. /******/ __webpack_require__.n = function(module) {
  4171. /******/ var getter = module && module.__esModule ?
  4172. /******/ function() { return module['default']; } :
  4173. /******/ function() { return module; };
  4174. /******/ __webpack_require__.d(getter, { a: getter });
  4175. /******/ return getter;
  4176. /******/ };
  4177. /******/ }();
  4178. /******/
  4179. /******/ /* webpack/runtime/define property getters */
  4180. /******/ !function() {
  4181. /******/ // define getter functions for harmony exports
  4182. /******/ __webpack_require__.d = function(exports, definition) {
  4183. /******/ for(var key in definition) {
  4184. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  4185. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  4186. /******/ }
  4187. /******/ }
  4188. /******/ };
  4189. /******/ }();
  4190. /******/
  4191. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  4192. /******/ !function() {
  4193. /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
  4194. /******/ }();
  4195. /******/
  4196. /******/ /* webpack/runtime/make namespace object */
  4197. /******/ !function() {
  4198. /******/ // define __esModule on exports
  4199. /******/ __webpack_require__.r = function(exports) {
  4200. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  4201. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  4202. /******/ }
  4203. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  4204. /******/ };
  4205. /******/ }();
  4206. /******/
  4207. /************************************************************************/
  4208. var __webpack_exports__ = {};
  4209. // This entry need to be wrapped in an IIFE because it need to be in strict mode.
  4210. !function() {
  4211. "use strict";
  4212. /*!****************************************************************************!*\
  4213. !*** ./src/advanced-custom-fields-pro/assets/src/js/pro/acf-pro-blocks.js ***!
  4214. \****************************************************************************/
  4215. __webpack_require__.r(__webpack_exports__);
  4216. /* harmony import */ var _acf_jsx_names_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./_acf-jsx-names.js */ "./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-jsx-names.js");
  4217. /* harmony import */ var _acf_jsx_names_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_acf_jsx_names_js__WEBPACK_IMPORTED_MODULE_0__);
  4218. /* harmony import */ var _acf_blocks_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./_acf-blocks.js */ "./src/advanced-custom-fields-pro/assets/src/js/pro/_acf-blocks.js");
  4219. }();
  4220. /******/ })()
  4221. ;
  4222. //# sourceMappingURL=acf-pro-blocks.js.map